• 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
NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB


  • Subject: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
  • From: Alex Kac <email@hidden>
  • Date: Thu, 14 Jan 2016 15:38:35 -0700

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];

********
WeatherCell* weatherCell = [outlineView makeViewWithIdentifier:self.identifierForWeatherCell owner:nil];

IB images:
<https://www.dropbox.com/s/o8g5y3t7rrf1whs/Screenshot 2016-01-14 15.33.13.png?dl=0>
<https://www.dropbox.com/s/ll9n526nw7e9pju/Screenshot 2016-01-14 15.33.28.png?dl=0>
<https://www.dropbox.com/s/yjidhle3lxx2aai/Screenshot 2016-01-14 15.33.22.png?dl=0>

The problem is that no matter the order of views in IB, the only one that works is “weatherCell” and not the narrow one - it just comes back nil. Reading the docs and stack overflow, I can’t seem to get a good answer to if this should work or not (having multiple cellViews in one NIB). Based on my initial tests…I’d say no. However the fact that ONE of them does work makes me curious if anyone else has ever gotten it to work.
_______________________________________________

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: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
      • From: Ken Thomases <email@hidden>
    • Re: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
      • From: Quincey Morris <email@hidden>
  • Prev by Date: drawRect: wrong scale in a programmatically created window
  • Next by Date: Re: drawRect: wrong scale in a programmatically created window
  • Previous by thread: Re: drawRect: wrong scale in a programmatically created window
  • Next by thread: Re: NSTableView registerNib:forIdentifier: - multiple IDs in a single NIB
  • Index(es):
    • Date
    • Thread