2011-02-28 68 views
0


我想在視圖的顯示方向上更改視圖的方向。
例如:
無論何時用戶單擊按鈕,都會向用戶顯示新視圖。無論什麼方向,我都希望在橫向模式下顯示此視圖。
任何想法.....更改iPhone中視圖的方向

回答

2

添加此功能在新視圖中將方向更改爲橫向模式。

- (BOOL)shouldAutorotateToInterfaceOrientationUIIn terfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
    } 
+0

它仍然只顯示縱向模式下的視圖。當手機傾斜時,它會切換到橫向模式。但是我想在加載視圖時將其更改爲橫向模式;) – SNR 2011-02-28 09:39:52

0

添加到您的視圖控制器

- (BOOL)shouldAutorotateToInterfaceOrientationUIIn terfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
    } 
2

使用此功能,在您的類。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 

    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||       
    interfaceOrientation == UIInterfaceOrientationLandscapeLeft); 

}