• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
setFrameSize called multiple times for a single size change?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setFrameSize called multiple times for a single size change?


  • Subject: setFrameSize called multiple times for a single size change?
  • From: Stuart Malin <email@hidden>
  • Date: Tue, 21 Jul 2009 09:17:43 -0700

I have a sub-classed TableView that is the document view of an ScrollView. The rows of the TableView are composited by a custom cell, and soI have overridden the -setFrameSize method of the TableView in order to determine if any rows have changed height as a consequence of the resize (if so, I invoke - noteHeightOfRowsWithIndexesChanged). After performing that calculation (and call to inform the table if any rows did change height), I then call the -setFrameSize of the super class (the NSTableView).

What I am seeing is that upon invoking the super class's -setFramSzie method, the overridden -setFrameSize is invoked twice more: the first time with the *old* size, then twice with the new size. While my app functions, I am troubled by these seemingly extra calls, and wonder if I haven't configured some setting of the TableView or ScrollView that I should. All of these objects are instantiated programmatically (not in IB). I set a breakpoint to examine the calling stack to see what was going on.

The call to set the old size comes from -resizeWithOldSuperviewSize. The docs say this can be overriden, so I have done so, making it a no- op method (that is, not invoking the super class). My app seems to perform just fine.

Question 1 --> Is this okay to do??

The two calls for the new size come, it seems to me, as a consequence of the TableView sizing the column (there is only one column in the table), as indicated by these two calling stacks:

#0 0x00041148 in -[TweetsListTableView setFrameSize:] at TweetsListTableView.m:181
#1 0x93ba6057 in -[NSTableView tile]
#2 0x93baefcf in -[NSTableColumn setWidth:]
#3 0x93baeae0 in -[NSTableView _sizeTableColumnsToFitWithStyle:forceExactFitIfPossible:]
#4 0x93bae24a in -[NSTableView _sizeTableColumnsToFitForAutoresizingWithStyle:]
#5 0x93bae1d4 in -[NSTableView sizeLastColumnToFit]
#6 0x93bae00f in -[NSTableView _autoresizeToFit]
#7 0x93badd34 in -[NSTableView superviewFrameChanged:]



#0 0x00041148 in -[TweetsListTableView setFrameSize:] at TweetsListTableView.m:181
#1 0x93ba6057 in -[NSTableView tile]
#2 0x93bae1e6 in -[NSTableView sizeLastColumnToFit]
#3 0x93bae00f in -[NSTableView _autoresizeToFit]
#4 0x93badd34 in -[NSTableView superviewFrameChanged:]


I now cache the last size given to the -setFrameSize method, and don't perform my testing for row height changes if the width hasn't changed, so I am no longer incurring that calculation cost.

Question 2 --> Is there a better way to configure the single column's resizing mask to avoid the double call?

TIA,
--Stuart

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: setFrameSize called multiple times for a single size change?
      • From: Stuart Malin <email@hidden>
    • Re: setFrameSize called multiple times for a single size change?
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: what is this currency symbol?
  • Next by Date: Re: what is this currency symbol?
  • Previous by thread: Re: what is this currency symbol?
  • Next by thread: Re: setFrameSize called multiple times for a single size change?
  • Index(es):
    • Date
    • Thread