Re: TableView crash with Delegate
Re: TableView crash with Delegate
- Subject: Re: TableView crash with Delegate
- From: Jonathan Mitchell <email@hidden>
- Date: Tue, 14 Jun 2016 12:36:27 +0100
> On 14 Jun 2016, at 12:26, Gerriet M. Denkmann <email@hidden> wrote:
>
>
> But no problem, as long one keeps in mind (as you recommended) that awakeFromNib “can get called many times”.
>
You may be experiencing this, as described in docs for view based table views:
NSTableView - (__kindofNSView <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/index.html#//apple_ref/doc/c_ref/NSView> *)makeViewWithIdentifier:(NSString <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html#//apple_ref/doc/c_ref/NSString> *)identifier
owner:(id)owner
This method is usually called by the delegate in tableView:viewForTableColumn:row: <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/NSTableViewDelegate/tableView:viewForTableColumn:row:>, but it can also be overridden to provide custom views for the identifier. Note that awakeFromNib <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSNibAwaking_Protocol/index.html#//apple_ref/occ/instm/NSObject/awakeFromNib> is called each time this method is called, which means that awakeFromNib is also called on owner, even though the owner is already awake.
This has thrown me for loop in the past - especially when the above note was only in the headers.
J
>
> Kind regards,
>
> Gerriet.
>
>
> _______________________________________________
>
> 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
_______________________________________________
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