如何強制一個視圖進入橫向模式的圖形。iPhone,如何強制一個視圖進入橫向模式?
我想單擊一個標籤欄按鈕,使圖形視圖出現,然後當在該視圖上單擊一個按鈕時,我想要在縱向模式下推動一個子畫面。
一旦他們點擊回我想要返回到橫向圖形視圖。
如何強制一個視圖進入橫向模式的圖形。iPhone,如何強制一個視圖進入橫向模式?
我想單擊一個標籤欄按鈕,使圖形視圖出現,然後當在該視圖上單擊一個按鈕時,我想要在縱向模式下推動一個子畫面。
一旦他們點擊回我想要返回到橫向圖形視圖。
使用的UIView的transform屬性通過PI弧度旋轉它:
-(void)viewWillAppear:(BOOL)animated
{
CGAffineTransform newTransform = CGAffineTransformMake(0.0,1.0,-1.0,0.0,0.0,0.0);
self.view.transform = newTransform;
}
也許這會爲工作,你
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft animated:NO];
或
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
setOrientation爲k不應該是被拒絕的原因 – estemendoza 2013-03-18 22:29:49
請注意,這個答案是非常古老的。 – 2014-11-12 13:40:43