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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:36:53+00:00 2026-06-10T01:36:53+00:00

I am trying to use UIViewController ‘s transitionFromViewController:toViewController:duration method but with a custom animation.

  • 0

I am trying to use UIViewController‘s transitionFromViewController:toViewController:duration method but with a custom animation.

I have the following two view controllers added as children to a custom container UIViewController:

  1. firstController – This is an instance of UITabBarController
  2. secondController – This is a subclass of UIViewController

The following code works as expected:

[self transitionFromViewController:firstController
                  toViewController:secondController 
                          duration:2                                         
                           options:UIViewAnimationOptionTransitionFlipFromLeft  
                        animations:^(void){} 
                        completion:^(BOOL finished){}];

However I would like to create a custom animation where the where firstController slides to the left and is replaced by secondController sliding in from the right similar to how UINavigationControllers push and pop methods work. After changing the options to UIViewAnimationOptionTransitionNone I have tried to implement custom animations in the animations block but have had absolutely no success. firstController is immediately swapped for secondController without and animations.

I would really appreciate any help.

Thank you

  • 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-06-10T01:36:54+00:00Added an answer on June 10, 2026 at 1:36 am

    This is actually really easy. For some reason I assumed that the secondController‘s view would be be under/ behind that of firstController‘s. I had only tried to animate the firstController‘s view. This of course is wrong. As soon as transitionFromViewController:toViewController:duration is called secondController‘s view is placed over firstController‘s view. The following code works:

    CGFloat width = self.view.frame.size.width;
    CGFloat height = self.view.frame.size.height;
    
    secondController.view.frame = CGRectMake(width, 0, width, height);
    
    [self transitionFromViewController:firstController
        toViewController:secondController
        duration:0.4
        options:UIViewAnimationOptionTransitionNone
        animations:^(void) {
            firstController.view.frame = CGRectMake(0 - width, 0, width, height);
            secondController.view.frame = CGRectMake(0, 0, width, height);
        } 
        completion:^(BOOL finished){
            [secondController didMoveToParentViewController:self]; 
        }
    ];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
So, I'm trying to use the UIPageViewController with a custom application workflow, but I'm
I am trying to use delegation between two Viewcontrollers, but unfortunately my delegate doesn´t
I'm trying to use the pushViewController: animated: with a UIViewController. I have it housed
I am trying to use dismissModalViewController:Animated: to dismiss my view, but it is not
i am trying and trying.... but no result yet. i have a view with
I am trying use gem tire to search in my application. I have tables
Hi I'm trying use a datepicker on a field I have. I'm trying to
trying to use hibernate with my web app and getting following exception: Initial SessionFactory
Trying to use Powershell to script the removal of specific custom errors from an

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.