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 3786998
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:46:17+00:00 2026-05-19T11:46:17+00:00

I simply can’t get this to work, I would think it was simple, but

  • 0

I simply can’t get this to work, I would think it was simple, but no luck.

- (void) animate {

    UIView *viewA = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 300.0f, 100.0f)];
    [viewA setBackgroundColor:[UIColor blueColor]];
    UIView *viewB = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 300.0f, 100.0f)];
    [viewB setBackgroundColor:[UIColor brownColor]];

    UIView *container = [[UIView alloc] initWithFrame:CGRectMake(10.0f, 10.0f, 300.0f, 100.0f)];
    [container addSubview:viewA];

    [self.view addSubview:container];

    [UIView transitionWithView:container
                      duration:0.4
                       options:UIViewAnimationOptionTransitionFlipFromLeft
                    animations:^{
                        [[[container subviews] objectAtIndex:0] removeFromSuperview];
                        [container addSubview:viewB];
                    }
                    completion:^(BOOL finished){

                    }];


}

This is how the documentation recommends you do it, make a container, add/remove the two subviews you want to flip between.

I can’t get it to work. It will just display viewA, then viewB, as if the animation part is skipped, but the block is carried out?

If I switch the container in the [UIView transitionWithView:container with self.view it flips the entire view (As suspected) but I can not get it to do this with 2 subviews of self.view.

Is there no way around this?

I am looking to do something like the iPad Photos app, where a picture will flip and scale to full screen.

I really hope someone could help me out here, thank you in advance.

  • 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-19T11:46:18+00:00Added an answer on May 19, 2026 at 11:46 am

    You can’t put semicolons inside the block. If you want two things done in there, divide them with a “,”.
    Also CurveEase would probably be nice., if you want it.

    This should work.

    [UIView transitionWithView:container
                      duration:0.4
                       options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionCurveEaseInOut
                    animations:^{
                        [[[container subviews] objectAtIndex:0] removeFromSuperview],
                        [container addSubview:viewB];
                    }
                    completion:^(BOOL finished){
    
                    }];
    

    If it does not, consider making the views instance variables and make sure they’re allocated before you try to animate them. If you want to animate on a button push, you can do it directly with sender too, if the whole view is a UIButton.

    I hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems to be something obvious but I simply can't find info by googling.
I've tried many functions already, but I simply can't figure this out. The right
According to this site I can simply write $user = getlogin(); but the group
I simply can't work this out, I'm attempting to sum the value of TOTAL
Doesn't matter what I do, I simply can't get this to play a sound
I've searched all posts on google and stackoverflow but I simply can't solve this
I know this must have been answered before here, but I simply can't find
This should be straight foreward, but I simply can't figure it out(!) I have
I simply can not get Visual Studio 2005 to find the System.Configuration.ConfigurationManager class. Here
I know I should do my homework on my own but I simply can't

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.