arachide
arachide

Reputation: 8066

multi viewcontrollers and rotation

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.

Upvotes: 0

Views: 433

Answers (1)

Vinzius
Vinzius

Reputation: 2901

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 !

Upvotes: 1

Related Questions