RootViewController.mm文件里找到 - (NSUInteger) supportedInterfaceOrientations方法。如果想让程序是竖屏,直接return
UIInterfaceOrientationMaskPortrait。横屏是默认的,当然也可以选择别的,自己跟到源码里找,应该不难。
大概是以下几个
UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait),
UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft),
UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight),
UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown),
UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown),
UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight)
其余地方貌似不用改
 
                   
                   
                   
                   
                             本文介绍如何在iOS应用中设置屏幕方向,特别是如何锁定应用为竖屏模式。通过修改RootViewController.mm文件中的-(NSUInteger)supportedInterfaceOrientations方法并返回UIInterfaceOrientationMaskPortrait,可以轻松实现这一目标。
本文介绍如何在iOS应用中设置屏幕方向,特别是如何锁定应用为竖屏模式。通过修改RootViewController.mm文件中的-(NSUInteger)supportedInterfaceOrientations方法并返回UIInterfaceOrientationMaskPortrait,可以轻松实现这一目标。
           
       
           
                 
                 
                 
                 
                 
                
               
                 
                 
                 
                 
                
               
                 
                 扫一扫
扫一扫
                     
              
             
                   1363
					1363
					
 被折叠的  条评论
		 为什么被折叠?
被折叠的  条评论
		 为什么被折叠?
		 
		  到【灌水乐园】发言
到【灌水乐园】发言                                
		 
		 
    
   
    
   
             
            


 
            