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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:47:08+00:00 2026-05-27T05:47:08+00:00

I am trying to mimic UINavigationController’s pushViewController using UIView animation but I have seem

  • 0

I am trying to mimic UINavigationController’s pushViewController using UIView animation but I have seem to run into an issue. I cannot animate the self.view.frame.

This is the code I am using but self.view just won’t move!

    [self.view addSubview:myViewController.view];
    [myViewController.view setFrame:CGRectMake(320, 0, 320, 480)];    
    [UIView animateWithDuration:0.5 
                     animations:^{
                         [self.view setFrame:CGRectMake(-320, 0, 320, 480)];
                         [myViewController.view setFrame:CGRectMake(0, 0, 320, 480)];
                     }
                     completion:^(BOOL finished){
                         [view1.view removeFromSuperview];
                     }];

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-27T05:47:08+00:00Added an answer on May 27, 2026 at 5:47 am

    Consider where the views are just before the animations start:

    • self.view.frame is (I assume) 0,0,320,380
    • myViewController.view is a subview of self.view
    • myViewController.view.frame is 320,0,320,480 in self.view‘s coordinate system, so it’s outside of its superview’s frame (and off the right edge of the screen)

    Now consider where the views are after the animations finish:

    • self.view.frame is -320,0,320,480
    • myViewController.view is still a subview of self.view
    • myViewController.view.frame is 0,0,320,480 in self.view‘s coordinate system, so it’s fully inside its superview’s frame, but its frame in screen coordinates is -320,0,320,480, so it is now entirely off the left edge of the screen

    You need to make myViewController.view a sibling of self.view, not a subview. Try this:

    // Calculate the initial frame of myViewController.view to be
    // the same size as self.view, but off the right edge of self.view.
    // I don't like hardcoding coordinates...
    CGRect frame = self.view.frame;
    frame.origin.x = CGRectGetMaxX(frame);
    myViewController.view.frame = frame;
    [self.view.superview addSubview:myViewController.view];
    // Now slide the views over.
    [UIView animationWithDuration:0.5 animations:^{
        CGRect frame = self.view.frame;
        myViewController.view.frame = frame;
        frame.origin.x -= frame.size.width;
        self.view.frame = frame;
    } completion:^(BOOL done){
        [view1.view removeFromSuperview];
    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I'm trying to PUT data using libcurl to mimic the command curl -u test:test
This is long but I promise it's interesting. :) I'm trying to mimic the
Using this site as a reference. Trying to mimic this effect using JavaScript, hover
I am trying to mimic a page form from: https://lo5.medseek.com/lfserver/UH_Pre-Registration_Form But I dont know
I have javascript code that i am trying to mimic in an android application:
I am trying to mimic something that I have seen a few different times.
I'm trying to mimic the following Java code: int[][] multi; // DIMENSIONS ARE UNKNOWN
I'm trying to mimic what every other tabular view does with the DataGridView control,
Trying to make a MySQL-based application support MS SQL, I ran into the following

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.