Note that there are some explanatory texts on larger screens.

plurals
  1. POSubviews not loaded from NIB with initWithNibName
    primarykey
    data
    text
    <p>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. </p> <ul> <li>TripDetailsController.view is linked to the TripDetailsView (UIView) in Interface Builder</li> <li>tdController does have a value, so it looks as if it is loaded</li> <li>TripDetailsController is in a separate NIB file</li> <li>Using iPhone SDK 2.2.1 (so not 3.0 yet)</li> </ul> <p>Code:</p> <pre><code> TripDetailsController *tdController = [[TripDetailsController alloc] initWithNibName:@"TripDetailsController" bundle:nil]; [self.navigationController pushViewController:tdController animated:YES]; [tdController release]; </code></pre> <p>In the TripDetailsController class I added the viewDidLoad method like this:</p> <p>Code: </p> <pre><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); } </code></pre> <p>The log messages below do show that the subviews are there, but also that the bounds are not set:</p> <p>Code: </p> <pre><code>6/18/09 Jun 18, 2009 10:06:00 PM ReisAdvies[11226] Subviews: ( &lt;UILabel: 0x56f250&gt;, &lt;UILabel: 0x56f5a0&gt;, &lt;UILabel: 0x56f6b0&gt;, &lt;UILabel: 0x56f780&gt; ) 6/18/09 Jun 18, 2009 10:06:00 PM ReisAdvies[11226] Subview 0 bounds: (null) </code></pre> <p>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?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload