Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>EDIT:</p> <p>Given your explanation in the comments, I think that the best approach to this would be using notifications. That is:</p> <ol> <li><p>when the "goHome" button is pressed in one sub-app controller, a notification is posted;</p></li> <li><p>the app list controller is registered to handle that kind of notifications, so it is notified when the button is pressed and can do what required.</p></li> </ol> <p>This would look like this, more or less:</p> <ol> <li><p>In your sub-app controller:</p> <pre><code>- (void) goHome: (id)sender { NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter postNotificationName:@"GOHOMEPRESSED" object:nil userInfo:nil]; } </code></pre></li> <li><p>In your app list controller:</p> <pre><code>- (void)viewDidLoad { ... [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(goHome) name:@"GOHOMEPRESSED" object:nil]; ... } - (void)goHome { [self dismissViewControllerAnimated:YES completion:NULL]; } </code></pre></li> </ol> <p>You can change the notification name used, of course (@"GOHOMEPRESSED") provided you use it consistently.</p> <p>Don't forget to remove the observer in your app list controller's <code>dealloc</code> method (I leave this to you).</p> <p>Also, try to get the logics behind this:</p> <ol> <li><p>from a given controller you present a second controller (<code>presentViewController:Volumesapp</code>);</p></li> <li><p>this will bring you altogether outside of the controller hierarchy where you were before (in your case, the tab bar);</p></li> <li><p>when you are done with the presented controller, you must call <code>dismiss</code> on the presenting controller (the step done in 2/goHome), to get back (sort of) to where you were.</p></li> </ol> <p>Hope this helps.</p> <p>OLD ANSWER:</p> <p>If I understand correctly what you are trying to do, what you need is selecting the right sub-controller inside of your tab bar controller by using <code>setSelectedIndex</code>; something like this should work:</p> <pre><code>- (void) goHome: (id)sender { [self.tabBarController setSelectedIndex:2]; } </code></pre> <p>Your current solution will simply overlap your current controller with a new controller instance presented modally. So, you are not properly going to the first scene, to use your wording, your are altogether instantiating a new scene on top of the existing one.</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.
 

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