Re: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
Re: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
- Subject: Re: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
- From: Ken Thomases <email@hidden>
- Date: Thu, 14 Jan 2016 17:47:37 -0600
On Jan 14, 2016, at 4:38 PM, Alex Kac <email@hidden> wrote:
>
> I have a NIB with two views that I want to use depending on circumstances. I call one “weatherCell” and one “weatherCellNarrow”.
>
> I register it like this:
>
> - (NSString*)identifierForWeatherCell {
> return _narrowView ? @"weatherCellNarrow":@"weatherCell";
> }
> nib = [[NSNib alloc] initWithNibNamed:@"WeatherCell" bundle:nil];
> [self.outlineView registerNib:nib forIdentifier:self.identifierForWeatherCell];
I don't think you should register the NIB for one identifier or the other. You should register it for both. The "active" identifier is the one used for the call to -makeViewWithIdentifier:owner:, but there's no reason to be stingy with the registration.
Regards,
Ken
_______________________________________________
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