• 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
Re: UIView not loading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIView not loading


  • Subject: Re: UIView not loading
  • From: Matt Neuburg <email@hidden>
  • Date: Tue, 03 May 2011 09:14:26 -0700

On Tue, 03 May 2011 20:34:42 +1000, Brian Bruinewoud <email@hidden> said:
>What I'm trying to do:
>In a popover, I have buttons
>On touching a button, a subview will be created in the main view of the screen (that is, beneath the popover)

>    UIViewController *newRoom = [[ Room alloc ] initWithNibName: @"Room" bundle: nil ];
>    if( !newRoom )
>        NSLog(@"Extra Huh?!");
>
>    NSBundle *b = newRoom.nibBundle;
>    NSString *n = newRoom.nibName;
>    BOOL      l = newRoom.isViewLoaded;
>
>    NSLog(@"bundle:%@  nib:%@  loaded:%d", b, n, l );
>
>    UIView *nrV = newRoom.view;
>    if( !nrV )
>        NSLog(@"Huh?");

Don't use a view controller in this way. View controllers are for views that occupy the entire screen (e.g. the root view of the window) or for situations where something contains a view controller (such as an UINavigationController or a UIPopoverController). They are not for dumpster-diving in nibs. Just have a plain object subclass of your own with an outlet and use it as the nib's owner as you load the nib.

Also, what you're doing with loadView is insane. If you implement loadView, that means the view will not be loaded from the nib, so you're cancelling out the very thing you want to do. If you implement loadView you *must* supply the view right there and set the view property manually.

http://www.apeth.com/iOSBook/ch19.html

m.

--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

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

  • Prev by Date: Vertical alignment in NSTextView
  • Next by Date: Re: Binding multiple NSTableView and NSPopupButton to an NSArrayControler
  • Previous by thread: UIView not loading
  • Next by thread: block animation
  • Index(es):
    • Date
    • Thread