重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

浅谈iOS屏幕方向那点事儿-创新互联

一般的应用,只会支持竖屏正方向一个方向,支持多个屏幕方向的应用还是比较少的。

成都创新互联于2013年成立,先为盐边等服务建站,盐边等地企业,进行企业商务咨询服务。为盐边企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

不过我在工作的项目中,跟这个屏幕方向接触比较多,因为我们是一个有界面的 SDK,要让接入方接入的,一开始做没什么经验,考虑到接入方本身的屏幕方向可能是多种的,所以我们直接上来就支持四个方向,然后就是各种转屏的问题,90度旋转、180读旋转、270度旋转,测试手都快转断了。

后来觉的根本没必要,浪费了很多时间在解决屏幕方向的问题上,后来就简化到让接入方直接设置支持某个方向了。

一般的应用不用搞的这么的复杂,只要支持一两个屏幕方向就可以了。我也做一下跟屏幕方向有关的几点总结,希望能帮到一些开发者!

系统屏幕方向枚举

通过查看文档,用于控制系统屏幕方向的枚举如下:

// iOS 6 之前用于控制屏幕方向的枚举
typedef enum {
  UIInterfaceOrientationPortrait      = UIDeviceOrientationPortrait,
  UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
  UIInterfaceOrientationLandscapeLeft   = UIDeviceOrientationLandscapeRight,
  UIInterfaceOrientationLandscapeRight   = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;

// iOS 6 及之后版本用于控制屏幕方向的枚举
typedef enum {
  UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait),
  UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft),
  UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight),
  UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown),
  UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
  UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
   UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown),
  UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
   UIInterfaceOrientationMaskLandscapeRight),
} UIInterfaceOrientationMask;

另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章标题:浅谈iOS屏幕方向那点事儿-创新互联
转载来于:http://cqcxhl.com/article/cdiieo.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP