13

I am building a ipad application. when the applications starts i show it in landscape Right mode. But as soon as the application starts I get this message

Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation

I used this method in all my classes

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

I also set my supported interface orientations (iPad) to landscape right in my plist file. How to resolve this warning message?

southpark
  • 541
  • 2
  • 5
  • 19
  • If you try to use modal UITabBarController(upd. Yes you do), then see solution [here](http://stackoverflow.com/questions/6271978/presenting-uitabbarcontroller-modally-autorotate-problem). Official explanation why this happend [here](http://stackoverflow.com/questions/6636683/how-to-eliminate-two-stage-rotation-warning). – Alexander Jul 02 '12 at 10:26
  • @Alexander I do not show the tabbar modally. – southpark Jul 03 '12 at 11:26
  • Is you "Login screen" a NavigationController? All controllers,that must be "rootViewController",shouldn't be used as "modal". – Alexander Jul 05 '12 at 04:51
  • @Alexander LoginScreen is a shown as a modal to tabbar controller. All other controllers added to tabbar controller are under navigation controller as rootViewControllers. On login i dismiss the login modal to show the tabbars – southpark Jul 06 '12 at 10:37

5 Answers5

15

I just realized - after reading this answer - that I was simply using the Tab Bar Controller wrong: the tab bar should only be used as a root controller, however I inserted a navigation controller before it.

Community
  • 1
  • 1
Johan
  • 2,472
  • 1
  • 23
  • 25
7

You can also get this error message if you've run the app with an empty tab bar controller as root in your storyboard. I was just starting on an app and my UITabBarController has no view controllers yet, but is presenting a login modal.

Matthew Quiros
  • 13,385
  • 12
  • 87
  • 132
1

The problem is that your app is using one of these methods, which were deprecated in iOS 5.0:

didAnimateFirstHalfOfRotationToInterfaceOrientation:
willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:
willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:

You need to modify your view controllers to override willAnimateRotationToInterfaceOrientation:duration: instead, and to not override any of the "HalfOfRotation" methods.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • Where do i place this method. – southpark Jun 14 '12 at 10:33
  • what my app exactly does is-I have a tabbar application. I init a tabbarcontroller in my appdelegate and add all my classes to the array of tabbarcontroller. Then i add a login screen in the front of the tabbar and after login i show the tabbar. My application opens in the landscape mode, but i get this warning. also I think because of this i am getting my keyboard size incorrect. on displaying the keyboard width and height in landscape mode it gives me width = 352 and height =1024 in ipad 3. I seems that the system does not know that it is currently in landscape mode. Thanks – southpark Jun 15 '12 at 05:39
  • Did you search all your source code for those deprecated methods? – rob mayoff Jun 15 '12 at 05:56
  • Yes. Actually these methods do not appear anywhere in my code. – southpark Jun 15 '12 at 06:14
  • 2
    Since 6.0 at least willAnimateRotationToInterfaceOrientation:duration: also triggers this ... sometimes, i have two projects with just willAnimateRotationToInterfaceOrientation:duration: nothing else, one yields the notice, other doesn't, there must be cruft in the nib's causing it. – valexa Sep 22 '12 at 14:50
  • @valexa Thanks for the info..Appreciate it. – southpark Sep 28 '12 at 06:45
  • I just had this message appear for the first time after adding a UINavigationController to a Storyboard that previously didn't have one. I was targeting iOS 5.1 ... the message disappears once I changed deployment to target iOS 6.0. – brindy Nov 17 '12 at 00:25
  • @brindy Still havent moved to iOS 6.0. Once done i shall update this...Thanks – southpark Nov 27 '12 at 11:05
  • Experienced the same as Brindy, targeting 7.0 on Xcode5 - except changing deployment target isn't an option. – Johan Aug 18 '13 at 08:20
0

ckeck your array declaration for tab bar ..possible mistake u done: I declared array oblects after assigning

tabBarController.viewControllers = tabControlArry;
[tabControlArry addObject:navCOntroller];
[tabControlArry addObject:navController1];

correct way:

[tabControlArry addObject:navCOntroller];
[tabControlArry addObject:navController1];
tabBarController.viewControllers = tabControlArry;
kleopatra
  • 51,061
  • 28
  • 99
  • 211
AP_
  • 1,013
  • 12
  • 13
0

This error message is related to TabBarController usage. You can expect this error when you don't make your tabBarController as the "root controller" for your app. So make your TabBarController as the root controller & this error will no more pester you.

Mirco
  • 2,940
  • 5
  • 34
  • 57