我的應用程序由工具欄和背景UIView中的AVCaptureVideoPreviewLayer組成。 我希望看到該工具欄旋轉與設備方向,所以在我的主視圖控制器,我實現的功能:禁用UIView的自動旋轉
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait
|| interfaceOrientation == UIInterfaceOrientationLandscapeLeft
|| interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
這工作得很好,但是當界面方向改變,我看到背景UIView(帶有視頻圖層)也在旋轉,所以我的視頻視圖現在左右旋轉90度......這不是很酷!
所以我的問題是:有什麼辦法禁用特定的UIView自動旋轉動畫?
我看到一個類似的問題,這個:Disabling autorotate for a single UIView,但答案不適合我的問題,我真的需要背景視圖不會移動,而不是解決問題的一種「反動畫」。所以我決定提出這個話題。
任何想法?
謝謝!
我有同樣的問題。你解決了嗎?它適用於iOS 6嗎?你能提出一個完整的答案嗎?非常感謝。 – 2013-05-09 11:51:21