UIView not loading
UIView not loading
- Subject: UIView not loading
- From: Brian Bruinewoud <email@hidden>
- Date: Tue, 03 May 2011 20:34:42 +1000
Hi All,
This has got me annoyingly stumped.
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)
What's not happening:
The view isn't being instantiated
For debugging purposes, I've implemented the loadView method on the appropriate view controller to call super and log a message but the message never appears implying that loadVIew isn't being called.
Code where I try to create the view. This is the action behind the touch event.
- (IBAction) addRoom: (id) sender;
{
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?");
newRoom.view.frame = CGRectMake( 0, 0, 100, 100 );
newRoom.view.alpha = 0;
[ self.view addSubview: newRoom.view ];
nrV = newRoom.view;
if( !nrV )
NSLog(@"Still Huh?");
}
Code in loadView.
- (void) loadView
{
[ super loadView ];
NSLog( @"Room::loadView" );
}
The logging produced is this:
2011-05-03 20:10:45.210 drawing[924:207] Room::initWithNibName: Room bundle: (null)
2011-05-03 20:10:45.212 drawing[924:207] bundle:NSBundle </blah/blah/drawing.app> (loaded) nib:Room loaded:0
2011-05-03 20:10:45.213 drawing[924:207] Huh?
2011-05-03 20:10:45.216 drawing[924:207] Still Huh?
Why isn't the view being created? What do I need to do to force it to be created?
Thanks,
Brian._______________________________________________
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