I've got the code below in my RootViewController (which is a UITableViewController). This code is executed when the button in the navigation bar is clicked and then (in the simulator) the next view is shown. However, the subviews (UITextLabels, UIButtons) that are drawn in in the view managed by the TripDetailsController are not displayed. Also, in the navigation bar in the top of the screen, the 'back' button to the original view is not shown, but when I click on the left side of the navigation bar it does transition back to the original view.
- TripDetailsController.view is linked to the TripDetailsView (UIView) in Interface Builder
- tdController does have a value, so it looks as if it is loaded
- TripDetailsController is in a separate NIB file
- Using iPhone SDK 2.2.1 (so not 3.0 yet)
Code:
TripDetailsController *tdController = [[TripDetailsController alloc]
initWithNibName:@"TripDetailsController" bundle:nil];
[self.navigationController pushViewController:tdController animated:YES];
[tdController release];
In the TripDetailsController class I added the viewDidLoad method like this:
Code:
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"Reis Details";
NSLog(@"Subviews: %@", self.view.subviews);
UILabel *l = [self.view.subviews objectAtIndex:0];
NSLog(@"Subview 0 bounds: %@", l.bounds);
}
The log messages below do show that the subviews are there, but also that the bounds are not set:
Code:
6/18/09 Jun 18, 2009 10:06:00 PM ReisAdvies[11226] Subviews: (
<UILabel: 0x56f250>,
<UILabel: 0x56f5a0>,
<UILabel: 0x56f6b0>,
<UILabel: 0x56f780>
)
6/18/09 Jun 18, 2009 10:06:00 PM ReisAdvies[11226] Subview 0 bounds: (null)
In Interface Builder the "Label size" tab does show values for X/Y/W/H. Feels like I have to trigger it to do some layout activities, but call layoutSubviews in the viewDidLoad() does not help. Any ideas what might be the problem here?