自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iOS6.0旋轉(zhuǎn)兼容的那點(diǎn)事

移動開發(fā) iOS
在iOS 6.0之前我們都是使用shouldAutorotateToInterfaceOrientation方法來控制視圖、狀態(tài)欄的旋轉(zhuǎn),但是iOS 6.0及以后就要使用supportedInterfaceOrientations方法來控制旋轉(zhuǎn)了。

這兩天問答系統(tǒng)里,問ios橫豎屏切換、還有狀態(tài)欄旋轉(zhuǎn)的問題有點(diǎn)多,來些小心得,希望遇到的人少走彎路;
先貼官方說明:
iOS 6.0 Release Notes:
Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method 
of UIViewController is deprecated.In its place, you should use the supportedInterfaceOrientationsForWindow: 
and shouldAutorotate methods.

在iOS 6.0之前我們都是使用shouldAutorotateToInterfaceOrientation方法來控制視圖、狀態(tài)欄的旋轉(zhuǎn),但是iOS 6.0及以后
就要使用supportedInterfaceOrientations方法來控制旋轉(zhuǎn)了;
所以向iOS 6.0兼容的需要手動添加supportedInterfaceOrientations 方法,來控制視圖和
狀態(tài)欄的旋轉(zhuǎn),還有兩點(diǎn)需要說明:
1、在iOS 6.0之前,控制旋轉(zhuǎn)的代碼,無需和plist的中的Supported interface orientations一一對應(yīng),舉個(gè)例子:
plist的Supported interface orientations選項(xiàng)中支持,Portrait(bottom home button)、Landscape(right home button),無Landscape(left home button)
方法shouldAutorotateToInterfaceOrientation中強(qiáng)制支持UIInterfaceOrientationLandscapeLeft編譯執(zhí)行沒有任何問題,
但是在iOS 6.0中,如果在supportedInterfaceOrientations中添加UIInterfaceOrientationMaskLandscapeLeft編譯正常,
運(yùn)行過程中,左旋轉(zhuǎn)程序就會異常退出;所以程序支持旋轉(zhuǎn)的,代碼與plist一定要保持一致;
2、在Xcode 4.5之前旋轉(zhuǎn)支持的是
UIInterfaceOrientationLandscapeLeft  
 UIInterfaceOrientationLandscapeRight
UIInterfaceOrientationPortrait              
 UIInterfaceOrientationPortraitUpsideDown

而Xcode 4.5 GM Seed及Xcode 4.5.1旋轉(zhuǎn)支持的是(多了個(gè)All,還有Mask的修飾,Xcode 4.5之前是不識別的)
UIInterfaceOrientationMaskAll      
UIInterfaceOrientationMaskLandscapeLeft
UIInterfaceOrientationMaskLandscapeRight        
UIInterfaceOrientationMaskPortrait
UIInterfaceOrientationMaskPortraitUpsideDown

責(zé)任編輯:閆佳明 來源: oschina
相關(guān)推薦

2012-02-22 09:32:58

云計(jì)算微軟Azure

2018-03-15 15:12:00

潤乾報(bào)表集成

2011-04-14 14:23:06

軟件測試測試

2018-04-02 15:10:17

ToastSnackbarAndroid

2015-09-01 15:12:45

JavaHashMap那點(diǎn)事

2023-12-21 20:53:15

2013-10-12 13:26:08

設(shè)計(jì)加載

2011-05-25 19:37:47

2021-07-30 07:28:15

Kafka消息引擎

2011-08-31 10:15:48

桌面管理軟件

2012-06-11 15:02:53

ASP.NET

2013-04-28 09:50:02

PHPMySQL

2011-02-22 09:47:58

WatchStor 征

2009-07-03 14:16:30

JSP Servlet

2010-08-10 15:08:17

UPS電源評測

2015-08-07 15:39:26

仿微信語音界面源碼

2010-07-22 10:07:01

SharePoint

2015-11-05 18:03:15

虛擬化云計(jì)算資源池

2019-07-01 14:55:44

應(yīng)用安全web安全滲透測試

2018-10-22 13:34:24

SD-WAN運(yùn)維網(wǎng)絡(luò)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號