常用屏幕方向设置

来源:互联网 发布:openstack ubuntu 源 编辑:程序博客网 时间:2024/05/18 20:32

设备方向的设置

 

1.最常规的,在对应的targetsGeneral -- Deployment Info -- DeviceOrientation中勾选想要的方向


此方法和在plist.info中设置的效果是完全一样的,而且设置哪一边都会同步。



 

 

2.可以通过代码来设置方向,常用的方法有

- (BOOL)shouldAutorotate {    return YES;} - (NSUInteger)supportedInterfaceOrientations{    return UIInterfaceOrientationMaskPortrait;} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);}


通过项目配置来设置是全局的,通过代码设置方向可以做细节处理,如想要整个APP都是可旋转的,但是某一个控制要求只能横屏,则可以通过代码的方式设置这个控制器的方向

0 0
原创粉丝点击