Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView
Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView
- Subject: Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView
- From: Kyle Sluder <email@hidden>
- Date: Thu, 25 Jun 2009 18:55:18 -0700
On Thu, Jun 25, 2009 at 6:33 PM, Peter
Zegelin<email@hidden> wrote:
> Unfortunately my numberOfRowsInTableView is being called 'before'
> awakeFromNib, so initially numColumns = 0 and I get an error
> (myDataSize/numColumns will be infinite).
So set a flag in -awakeFromNib. Check this flag in
-numberOfRowsInTableView: and return 0 if this flag isn't set.
> I always thought awakeFromNib would get called first. But in this case not
> so. So can anyone suggest why, and a workaround?
The order of -awakeFromNib calls is not guaranteed. In fact, you
probably have an outlet from your tree controller to your table view,
so the table view must necessarily be awoken first, since all outlets
are guaranteed to be set up before -awakeFromNib is called.
NSTableView's -awakeFromNib probably causes it to probe its delegate.
--Kyle Sluder
_______________________________________________
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