开发者

Control over UIViewController interfaceorientation

I have a UIViewController which contains a new UIViewController l开发者_开发技巧ike below,

@implementation ParentViewController

- (id)init
{
   // some stuff
}

- (BOOL)CreateChildViewController
{
   UIViewController *childVC = [[UIViewController alloc] init];
}

@end

Now i need to stop interfaceOrientation of childVC.

Is it possible, if so how??


Try using:

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

to any view controller to determine auto rotate behaviour.

From the documentation:

By default, this method returns YES for the UIInterfaceOrientationPortrait orientation only. If your view controller supports additional orientations, override this method and return YES for all orientations it supports.

In short, if you subclass UIViewController and only want to support portrait, you don't need to do anything. Otherwise you will need to add this method and decide whether to allow rotation to another orientation.

Read the section titled "Handling View Rotations".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜