Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are using iOS 4.0 or later, the following will do exactly what you want (I just tested it out to make sure)</p> <pre><code>NewView *myNewView = [[NewView alloc] initWith.....]; [UIView transitionFromView:self.view toView:myNewView.view duration:1 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil]; //[self.navigationController pushViewController:myNewView animated:NO]; [myNewView release]; </code></pre> <p>EDIT: I'm changing the above code a bit (nothing new, just commenting out the navigation controller because it's not necessary for this).</p> <p>So there are several ways to go about this (as far as keeping track of the next view), but this is the easiest I can think of. You can already switch from view 1 to 2, so I'm going to explain how to get from 2 to 10 (or however many you need).</p> <p>Basically, the view transition lasts too long for <code>viewDidLoad</code> to catch a call to go to the next view. So what we need to do is set up a timer that waits and sends a method to switch at a later time. So this is the code you would see in view 2 (and 3 and 4, etc.).</p> <pre><code>- (void)viewDidLoad { // this gets called before animation finishes, so wait; self.navigationController.delegate = self; // you will need to set the delegate so it can take control of the views to swap them; [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(switchView) userInfo:nil repeats:NO]; } </code></pre> <p>I only wait 1 second until I call the switch method, but if you are loading a lot into your views, you may want to wait a bit longer. 1.5 seconds should be more than enough, but you can play around with that to see where it works and doesn't work.</p> <p>Next, you have to call the next view in the <code>switchView</code> method.</p> <pre><code>- (void)switchView { NextView *myNextView = [[NextView alloc] initWith ... ]; [UIView transitionFromView:self.view toView:nextView.view duration:1 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil]; [nextView release]; } </code></pre> <p>This worked perfectly for me. Just to make sure I was getting new views, I assigned tags to each view and added UILabels as subviews in each view's <code>viewDidLoad</code> method and each showed the number of its view. So hopefully this is what you needed. I'm sure you have more complex things you will need to do, but this will give you the animation and logic you need to get the look you want. (on a side note, <code>viewDidAppear</code> doesn't seem to get called when doing this, so it might be necessary to call it manually from <code>viewDidLoad</code> if you really need to use it, but otherwise it works fine)</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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