Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>How are you defining your views for <code>AViewController</code> and <code>BViewController</code>? Generally you'd use <code>initWithNibName</code>, e.g. </p> <pre><code>AViewController *aObj = [[AViewController alloc] initWithNibName:@"mynibname" bundle:nil]` </code></pre> <p>As Carl pointed out, you can apparently use just <code>init</code> (though I don't see this documented in the <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html" rel="nofollow"><code>UIViewController</code> Class Reference</a>), but then the system will be very particular about the name of your NIB file. The documentation does say, though, that you can use <code>initWithNibName</code> and pass a <code>nil</code> for the NIB name, in which case it will try to find it for you. Personally, if you're having inconsistent results, though, I'd try using <code>initWithNibName</code> and explicitly pass the name of your NIB, and see if that rectifies the situation.</p> <p>Or are you building your view programmatically with <code>loadView</code> in your two controllers? Then you need to show us those <code>loadView</code> routines (not to be confused with <code>viewDidLoad</code>).</p> <p>But according to the documentation, you need to either specify your NIB or use <code>loadView</code>. See the <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW55" rel="nofollow">View Management</a> discussion in the <code>UIViewController</code> Class Reference.</p> <p><strong>Update:</strong></p> <p>Given your feedback, I have a couple of thoughts:</p> <ol> <li><p>Needless to say, the problem is apparently not related to the above code. You need to broaden you search and show us more code. Perhaps show us your <code>viewDidLoad</code> of B?</p></li> <li><p>Generally when you don't get these sorts of events, it's because the view controller hierarchy has gotten out of sync with the view hierarchy. The most common way that people do this is if they've done something like "<code>[addSubview someNewController.view]</code>" at some point. If you're using a view controller in any context either than (a) your app delegate's initial configuration; (b) <code>presentViewController</code> (or dismiss); or (c) <code>pushViewController</code> (or pop), then you might want to share what you've done.</p></li> <li><p>As andreamazz pointed out, your comment, "My navigation controller is inside a view controller of the tab bar controller," is a little disturbing if one reads it literally. You can put navigation bar in a view controller's view, but you can't put a navigation controller in a view controller (unless you're doing view controller containment, which is a whole different beast). Equally concerning is where, in another one of your questions, you said, "Embedding a UINavigationController or UITabBarController (my case) in a UIViewController somehow interrupts with the calling of these methods." Thing is, you don't embed nav controllers in other view controllers (unless it is, itself, a container controller such as a tab view controller), but rather its the other way around. But if you literally mean that you have a controller that contains a nav controller, you have to show us how you're doing that (proper view controller containment?) because that's highly unusual. </p></li> <li><p>It's unusual, but I've had projects get corrupted, ending up in weird states. At a minimum, I might suggest "Product" - "Clean" and rebuild. If problem persists, and you've isolated the problem to to B's NIB, then temporarily rename the it and build a quick and dirty one from scratch.</p></li> </ol>
 

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