• 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
Overriding -[UIViewController loadView], and loading from a nib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Overriding -[UIViewController loadView], and loading from a nib


  • Subject: Overriding -[UIViewController loadView], and loading from a nib
  • From: Jonathan del Strother <email@hidden>
  • Date: Tue, 3 Nov 2009 12:46:30 +0000

Heya,

I'd like to get hold of the top level objects returned by -[NSBundle
loadNibNamed:owner:options:] when UIViewController loads my view.
Sadly UIViewController doesn't seem to provide any way of accessing
these, so I thought I might be able to just load the nib myself :

-(void)loadView {
	NSArray* topLevelObjects = [self.nibBundle loadNibNamed:self.nibName
owner:self options:nil];
	// do stuff with topLevelObjects...
}

which appeared to work pretty well, until I tried using it in a
UITableViewController subclass that's pushed onto a navigation
controller, where the view just turns out blank.  Stepping into
-[UIViewController loadView] in gdb suggests that it's doing a whole
lot more than just -loadNibNamed:

I could call [super loadView], but that means I end up loading the nib
twice, and re-assigning all the IBOutlets twice, which is pretty ugly.
 Any alternative suggestions?
_______________________________________________

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: Overriding -[UIViewController loadView], and loading from a nib
      • From: Jonathan del Strother <email@hidden>
  • Prev by Date: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Next by Date: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Previous by thread: Re: Strange behaviour with NSTableView binded to NSArrayController with NSSet as content
  • Next by thread: Re: Overriding -[UIViewController loadView], and loading from a nib
  • Index(es):
    • Date
    • Thread