DBInterfaceOrientationManager
App橫豎屏旋轉(zhuǎn)一句話管理 Just One Line
1.痛點(diǎn):
一般我們?cè)陂_(kāi)發(fā)App的時(shí)候在info.plist中Supported interface orientations
會(huì)默認(rèn)只選中Portrait
,也就是豎屏這樣能適應(yīng)絕大多數(shù)情景或悲,因?yàn)橐话沩?yè)面都是設(shè)計(jì)單豎屏的,但但但是在視頻播放時(shí)全屏播放需要數(shù)橫屏播放..這時(shí)候在plist
中多添加一個(gè)橫屏字段App又會(huì)胡亂旋轉(zhuǎn)编饺,真是頭疼,mmp
2.我們有一個(gè)更便捷的解決方案:
在需要開(kāi)啟設(shè)備自動(dòng)旋轉(zhuǎn)的時(shí)候使用
[DBInterfaceOrientationManager allowRotation:YES];
需要關(guān)閉的時(shí)候:
[DBInterfaceOrientationManager allowRotation:NO];
強(qiáng)制旋轉(zhuǎn)屏幕方向:
[DBInterfaceOrientationManager forceInterfaceOrientation:UIInterfaceOrientationPortrait];