Custom animation between UIViewControllers using transitionFromViewController:toViewController:duration

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


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
    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]; 

Need Your Help

php - unable to load & use Imagick (DLL errors) (Windows 8)

php dll windows-8 dependencies imagick

I have downloaded and installed Imagick, added it to the system path and successfully tested the installation.

limitation number of keys in memcached service

memcached key

I wanna know is there any limitation for number of keys stored in memcached?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.