开发者

Allow only LeftLandscape and RightLandscape orientation

How can I made my app to allow only the landscape orientati开发者_Go百科on but both (left and right)? so if I rotate 180° the app will be rotate but if I rotate in portrait the app doesn't rotate?

thanks


Try adding this to your UIViewController:

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
            interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

You can learn more about this here: UIViewController class reference

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜