tags:

views:

27

answers:

1

Hello everyone

I hope to rotate only one viewcontroller in a multi viewcontroller ( rootviewcontroller and viewcontroller 1, viewcontroller2,..)project.

Is it possible?

I noticed I have to make rootviewcontroller enable shouldAutorotateToInterfaceOrientation.

But the function willAnimateRotationToInterfaceOrientation in the viewcontroller that I prefer to rotate was not fired.

A: 

Hello

If you have sub controllers like :

RootViewController FirstViewController SecondViewController ...

When willAnimateRotationToInterfaceOrientation of RootViewController is called, you need to called yourself the same function of FirstViewController, SecondViewController etc.

For example

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

  [ FirstViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration ];
  [ SecondViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration ];

}

By the way, yes you need to implement shouldAutorotateToInterfaceOrientation to say if YES or NO the controller should rotate.

Good Luck !

Vinzius
Thanks. Is it possible only make FirstViewController rotate, rootViewcontroller and others do not rotate?
Hummm if FirstViewController is inside of rootViewcontroller, then rootViewcontroller will rotate if FirstViewController do the same. Try using shouldAutorotateToInterfaceOrientation in each controller to say if YES/NO they can rotate. If you may have some cases that will bother you ^^ sometimes you must make choice ^^ By the way, take a look at http://www.geckogeek.fr/iphone-forcer-le-mode-landscape-ou-portrait-en-cours-dexecution.html (french but code in english). It could help you to rotate just some controllers in some cases.
Vinzius