欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

iOS如何實(shí)現(xiàn)強(qiáng)制轉(zhuǎn)屏、強(qiáng)制橫屏和強(qiáng)制豎屏的實(shí)例代碼

 更新時(shí)間:2017年07月20日 09:14:04   作者:位之先  
本篇文章主要介紹了iOS如何實(shí)現(xiàn)強(qiáng)制轉(zhuǎn)屏、強(qiáng)制橫屏和強(qiáng)制豎屏的實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文介紹了iOS如何實(shí)現(xiàn)強(qiáng)制轉(zhuǎn)屏、強(qiáng)制橫屏和強(qiáng)制豎屏的實(shí)例代碼,分享給大家

今天項(xiàng)目中遇到正在看視頻的時(shí)候賬號(hào)被擠,如果當(dāng)時(shí)是橫屏的情況下,需要強(qiáng)制豎屏。真頭疼,網(wǎng)上找了好多方法,終于解決啦。O(∩_∩)O~

強(qiáng)制橫屏:

[self interfaceOrientation:UIInterfaceOrientationLandscapeRight];

強(qiáng)制豎屏:

[self interfaceOrientation:UIInterfaceOrientationPortrait];

強(qiáng)制轉(zhuǎn)屏

- (void)interfaceOrientation:(UIInterfaceOrientation)orientation
{
  if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
    SEL selector = NSSelectorFromString(@"setOrientation:");
    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
    [invocation setSelector:selector];
    [invocation setTarget:[UIDevice currentDevice]];
    int val = orientation;
    // 從2開始是因?yàn)? 1 兩個(gè)參數(shù)已經(jīng)被selector和target占用
    [invocation setArgument:&val atIndex:2];
    [invocation invoke];
  }
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論