新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
淺談iOS屏幕方向那點事兒-創(chuàng)新互聯(lián)
一般的應用,只會支持豎屏正方向一個方向,支持多個屏幕方向的應用還是比較少的。
不過我在工作的項目中,跟這個屏幕方向接觸比較多,因為我們是一個有界面的 SDK,要讓接入方接入的,一開始做沒什么經(jīng)驗,考慮到接入方本身的屏幕方向可能是多種的,所以我們直接上來就支持四個方向,然后就是各種轉屏的問題,90度旋轉、180讀旋轉、270度旋轉,測試手都快轉斷了。
后來覺的根本沒必要,浪費了很多時間在解決屏幕方向的問題上,后來就簡化到讓接入方直接設置支持某個方向了。
一般的應用不用搞的這么的復雜,只要支持一兩個屏幕方向就可以了。我也做一下跟屏幕方向有關的幾點總結,希望能幫到一些開發(fā)者!
系統(tǒng)屏幕方向枚舉
通過查看文檔,用于控制系統(tǒng)屏幕方向的枚舉如下:
// 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;
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)建站www.cdcxhl.com,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
本文標題:淺談iOS屏幕方向那點事兒-創(chuàng)新互聯(lián)
本文地址:http://www.ef60e0e.cn/article/cdiieo.html