Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You connect to things in IB by using<br> <code>IBOutlet UIView *myView;</code><br> or<br> <code>@property (nonatomic, retain) IBOutlet UIView *myView;</code><br> in your header file. The <code>IBOutlet</code> keyword tells IB to make that outlet available to connect.</p> <p>You make the actual connection in the Connection inspector by dragging from the outlet to the view: <a href="http://cl.ly/eb3b5cd826b20fc9e307/content">making a connection http://cl.ly/eb3b5cd826b20fc9e307/content</a></p> <p>(Do this for both your views.)</p> <p>Note: your views don't have to be inside the window in IB. You can create them outside, and they won't be displayed until you want them to. You might want to put one of them in so it shows up when your app launches.</p> <p>Then, when you actually want to flip to the other view, assuming you're using iOS 4.0, it's simple (there are methods for 3.x and lower, but this is the easiest):</p> <pre><code>[UIView transitionFromView:myView1 toView:myView2 duration:0.2 options:UIViewAnimationOptionTransitionFlipFromRight completion:^{ // something to do when the flip completes }]; </code></pre> <p>Or, if you want to dynamically determine which view is already visible:</p> <pre><code>UIView *oldView, *newView; UIViewAnimationOptions transition; if (myView1.superview) { // view 1 is already visible oldView = myView1; newView = myView2; transition = UIViewAnimationOptionTransitionFlipFromRight; } else { // view 2 is visible oldView = myView2; newView = myView1; transition = UIViewAnimationOptionTransitionFlipFromLeft; } [UIView transitionFromView:oldView toView:newView duration:0.2 options:transition completion:^{ // something to do when the flip completes }]; </code></pre>
 

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