开发者

Allow only LeftLandscape and RightLandscape orientation

开发者 https://www.devze.com 2023-01-02 12:54 出处:网络
How can I made my app to allow only the landscape orientati开发者_Go百科on but both (left and right)?

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

精彩评论

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