Prefs view with Nav Controller based app

Discussion in 'iOS Programming' started by macinsmith, Jan 22, 2010.

  1. macinsmith macrumors newbie

    Jan 22, 2010
    I have an app that uses a navigation controller and want to have a preferences view. Typically when this view is brought up, the current view rotates as if the preferences is on the back of that view. I have made this work in a non-navigation controller based app, but am having troubles getting it to work in a navigation based app. I want the entire view including the Nav bar to rotate out. Here is what I'm doing. This code is in the a subclass of UIViewController

    PrefsViewController *prefsViewController = [[PrefsViewController alloc] initWithNibName:@"PrefsView" bundle:nil];
         [UIView beginAnimations:@"View Flip" context:nil];
         [UIView setAnimationDuration:1.25];
         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
         UIViewController *coming = prefsViewController;
         UIViewController *going = self.navigationController; // (I've also tried setting going = self
         UIViewAnimationTransition transition= UIViewAnimationTransitionFlipFromLeft;
         [UIView setAnimationTransition: transition forView:self.view cache:YES];
         [coming viewWillAppear:YES];
         [going viewWillDisappear:YES];
         [going.view removeFromSuperview];
         [self.view insertSubview: coming.view atIndex:0];
         [going viewDidDisappear:YES];
         [coming viewDidAppear:YES];
         [UIView commitAnimations];
    Any ideas?
  2. macinsmith thread starter macrumors newbie

    Jan 22, 2010
    Found solution in another post

    Here's the code I found in another post

    - (IBAction)infoButtonWasPressed:(id)sender {
        // Display modal info view as flipside view
        PrefsViewController * prefsViewController = [[PrefsViewController alloc] initWithNibName:@"PrefsView" bundle:nil];
        prefsViewController = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController: prefsViewController animated:YES];
        [prefsViewController release];
    This works just fine.

Share This Page