Note that there are some explanatory texts on larger screens.

plurals
  1. POpopToViewController not animating
    primarykey
    data
    text
    <p>Man I must say if it wasn't for this site, I would have no hair and I would've probably jumped off of a bridge right now. OK! My problem:</p> <p>I'm using storyboard with xcode 4.4. I have a 3 view controllers (well 5 really but the others i THINK are irrelevant). View controller A pushes to view controller B. View controller B has a segmented control on its nav bar with 2 segments and a back button.View contoller B loads with segment 1 selected. When user selects segment 0, view controller C is then instantiated. All well and good on the first push. You get pushed to B from A, and can then when you press back it pops to A. My problem is when I popToViewController to an array list containing view controller A, it pops, but it doesnt animate! I know what you're thinking, "Animate:YES dummy!" However, animated IS yes..HUH? Here's my code:</p> <p><em>heres whats goin on in view controller B</em></p> <pre><code>-(IBAction)Previous:(id)sender{ [self.navigationController popViewControllerAnimated:YES]; } - (IBAction)segmentSwitch:(id)sender; { if ([sender selectedSegmentIndex] == 0) { MapViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Map"]; [self.navigationController pushViewController:controller animated:NO]; } else if ([sender selectedSegmentIndex] == 1) { ListViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"List"]; [self.navigationController pushViewController:controller animated:NO]; } } </code></pre> <p><em>heres view controller C</em></p> <pre><code>-(IBAction)Previous:(id)sender { NSInteger index = -1; ReportAppDelegate *appDelegate = (ReportAppDelegate *)[[UIApplication sharedApplication]delegate]; MainOrangeTestViewController *orangeViewController = [appDelegate orangeViewController]; orangeViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Orange"]; NSArray* newVCarray = [[NSArray alloc] initWithObjects:orangeViewController, nil]; self.navigationController.viewControllers = newVCarray; for(int i=0 ; i&lt;[newVCarray count] ; i++) { if([[newVCarray objectAtIndex:i] isKindOfClass:NSClassFromString(@"MainOrangeTestViewController")]) { index = i; } } [self.navigationController popToViewController:[newVCarray objectAtIndex:index] animated:YES]; } - (IBAction)segmentSwitch2:(id)sender; { if ([sender selectedSegmentIndex] == 0) { MapViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Map"]; [self.navigationController pushViewController:controller animated:NO]; } else if ([sender selectedSegmentIndex] == 1) { ListViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"List"]; [self.navigationController pushViewController:controller animated:NO]; } } </code></pre> <p>I know when you instantiate you are creating a new instance of that view controller as well as creating a new nav stack (or something like that). I'm thinking that might have something to do with it. Regardless, why on earth is it not animating the pop? I'm hoping to implement something in my current build, however if it requires a rebuild then so be it! Any help is greatly appreciated. I've definitely done my homework on this one however no solution. </p> <p>Thanks to all in advance!</p> <p>EDIT: I should add that the initial POP back to A from view controller B is animated. HOwever when you start to toggle the segmented controls AND when you toggle to view contrller C, going back to view controller A doesn't animate the pop. So initially when you load to B from A it pops back with successful animation. But after the toggle it pops back to A with no animation and the animated method is YES.</p>
    singulars
    1. This table or related slice is empty.
    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