Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 942019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:12:22+00:00 2026-05-15T22:12:22+00:00

So I basically have two subviews within my main view. I created each subview

  • 0

So I basically have two subviews within my main view. I created each subview by going to the library in IB and dragging a view onto my main nib file and then positioning controls on them.

Now, I’d like to flip between these views via a “flip” button. What I don’t understand is how I can programmatically do this.

My question is: do I “Hide” one of the subviews and then unhide it someway programmatically when I do the flip? Do I give each a name via the Interface Builder and do it that way? I don’t really need the code to actually do the flip or anything, I just need a conceptual understanding of how I’d refer to views built in IB programmatically and if hiding makes sense in my scenerio…

Any suggestions? thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:12:22+00:00Added an answer on May 15, 2026 at 10:12 pm

    You connect to things in IB by using
    IBOutlet UIView *myView;
    or
    @property (nonatomic, retain) IBOutlet UIView *myView;
    in your header file. The IBOutlet keyword tells IB to make that outlet available to connect.

    You make the actual connection in the Connection inspector by dragging from the outlet to the view:
    making a connection

    (Do this for both your views.)

    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.

    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):

    [UIView transitionFromView:myView1
                        toView:myView2
                      duration:0.2
                       options:UIViewAnimationOptionTransitionFlipFromRight
                    completion:^{
                        // something to do when the flip completes
                    }];
    

    Or, if you want to dynamically determine which view is already visible:

    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
                    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have two projects basically, each of 2 these main projects have sub projects
Basically I have created two MATLAB functions which involve some basic signal processing and
Okay so I have two png files, a circle and a maze. Basically the
Ok here it is. i have two tables: products and product_sizes so basically my
I have two elements with a class name each. And on some event I'd
I've got an app that has two parts. Basically, the first part shows a
I have two byte[] and I want to find the first occurrence of the
I am essentially creating a blog application in django as a way of learning
Ok so I am having a problem with doing multiple forms in rails. here
'm developing a 2D game and I want separate the game engine from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.