开发者

multi viewcontrollers and rotation

I hope to rotate only one viewcontroller in a multi viewcontroller ( rootviewcontroller and viewcontroller 1, viewcontroller2,..)project开发者_Go百科.

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.


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 !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜