第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在iOS 6中以編程方式更改設(shè)備方向

如何在iOS 6中以編程方式更改設(shè)備方向

iOS
慕工程0101907 2019-10-09 14:39:10
在iOS 5中,我們可以通過編程方式更改設(shè)備方向,如下所示:[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];但是在iOS 6 setOrientation中已棄用,如何在iOS 6中以編程方式更改設(shè)備方向?
查看完整描述

3 回答

?
手掌心

TA貢獻(xiàn)1942條經(jīng)驗(yàn) 獲得超3個(gè)贊

這是我的“五美分”,已在iOS7和ARC上進(jìn)行了測(cè)試


[[UIDevice currentDevice] setValue:

                      [NSNumber numberWithInteger: UIInterfaceOrientationPortrait]

                            forKey:@"orientation"];

這不會(huì)像performSelector那樣生成“泄漏”警告。


UIAlertView-使用此代碼,當(dāng)您在視圖中打開UIAlertView時(shí)(會(huì)/已)出現(xiàn)時(shí),您會(huì)注意到,除了該視圖以外的所有視圖都是縱向的(蘋果,真的嗎?)我無法強(qiáng)制視圖重新定向,但是發(fā)現(xiàn)您在打開UIAlertView之前稍加延遲,然后視圖就有時(shí)間更改方向。


請(qǐng)注意,我將從2014年12月9日開始發(fā)布我的應(yīng)用程序周,如果發(fā)布會(huì)通過或失敗,我將對(duì)其進(jìn)行更新。


查看完整回答
反對(duì) 回復(fù) 2019-10-09
?
蠱毒傳說

TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超3個(gè)贊

這不能回答如何更改設(shè)備方向,而是可以幫助您的其他信息。


iOS 6 UI界面方向-shouldAutorotateToInterfaceOrientation:不起作用


iOS 6不支持方法shouldAutorotateToInterfaceOrientation:不建議使用。以防萬一,如果你是一個(gè)新手,誰只是盯著可可工作,并想知道為什么你的視圖控制器在iOS 6中搞砸了完善的iOS 5中,只知道shouldAutorotateToInterfaceOrientation:不支持了。即使它在Xcode 4到4.3上都能很好地工作,在Xcode 4.5上也無法工作。


蘋果提供了一種新的方法來以更清潔的方式完成此任務(wù)。您可以改用supportedInterfaceOrientations。它返回視圖控制器支持的所有界面方向,以及界面方向值的掩碼。


UIInterfaceOrientationMask枚舉:


這些常量是用于指定視圖控制器支持的接口方向的掩碼位。


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;

使用shouldAutorotateToInterfaceOrientation:方法:


-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {

    return UIInterfaceOrientationIsLandscapeRight(toInterfaceOrientation);

}

使用supportedInterfaceOrientations方法:


-(NSUInteger)supportedInterfaceOrientations{

    return UIInterfaceOrientationMaskLandscapeRight;

}

這些是UIViewController中有關(guān)iOS6中方向的添加方法


UIViewController preferredInterfaceOrientationForPresentation


UIViewController應(yīng)該自動(dòng)旋轉(zhuǎn)


UIViewController支持的InterfaceOrientations


向UIApplication添加了有關(guān)iOS6中方向的方法


UIApplication支持的InterfaceOrientationsForWindow:


UIInterfaceOrientationMask


查看完整回答
反對(duì) 回復(fù) 2019-10-09
  • 3 回答
  • 0 關(guān)注
  • 522 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)