Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize horizontal and Vertical screen setting by iOS

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to achieve iOS horizontal and vertical screen settings, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Horizontal and vertical screen below iOS 6, rewrite the method in ViewController

-(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation {/ / system macro definition only horizontal screen return UIDeviceOrientationIsLandscape (toInterfaceOrientation); / / system macro definition only vertical screen return UIDeviceOrientationIsPortrait (toInterfaceOrientation); / / you can also implement vertical screen only, with the home key below return (toInterfaceOrientation = = UIDeviceOrientationPortrait); / / you can also implement vertical screen only with home key return above (toInterfaceOrientation = = UIDeviceOrientationPortraitUpsideDown) / / you can also implement vertical screen only on your own, with return button on the right (toInterfaceOrientation = = UIDeviceOrientationLandscapeLeft); / / you can also implement vertical screen only on your own, and home button is return on the left (toInterfaceOrientation = = UIDeviceOrientationLandscapeRight);}

IOS 6 or above, set in AppDelegate. After setting, you need to set the screen in Target "Summary" Support Interface Orientations. Failure to set the same screen will cause flicker.

# if _ _ IPHONE_OS_VERSION_MAX_ALLOWED > = _ IPHONE_6_0-(NSUInteger) application: (UIApplication *) application supportedInterfaceOrientationsForWindow: (UIWindow *) window {/ / horizontal screen home key below return UIInterfaceOrientationMaskPortrait; / / horizontal screen home key on the right return UIInterfaceOrientationMaskLandscapeLeft; / / horizontal screen home key on the left return UIInterfaceOrientationMaskLandscapeRight; / / vertical screen home key on top return UIInterfaceOrientationMaskPortraitUpsideDown; / / landscape screen return UIInterfaceOrientationMaskLandscape / / four-way flip return UIInterfaceOrientationMaskAll; / / except vertical screen, three-way flip return UIInterfaceOrientationMaskAllButUpsideDown;} # endif is all the contents of this article "how to achieve horizontal and vertical screen settings in iOS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report