2013-07-02 40 views
0

我的銀行應用程序設計良好。縱向顯示我帳戶中的動作,如果iPhone處於橫向模式(右側或左側),則會顯示帶有兩個軸的圖表。我該如何做這樣的事情?我在我的應用程序很多意見,我只需要在人像模式,但對於一個觀點,我需要顯示在橫向模式下的內容..旋轉視圖以擴展內容

我嘗試這樣做:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft); 
} 
+0

嘗試過了,你是怎麼得到?當'toInterfaceOrientation'爲'UIInterfaceOrientationLandscapeLeft'或'UIInterfaceOrientationLandscapeRight'時,您必須在此方法中編寫您的需求代碼 – Rakesh

回答

0

用途:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

在UIApplication.h定義其它宏:

UIDeviceOrientationIsValidInterfaceOrientation(orientation) 

UIInterfaceOrientationIsPortrait(orientation) 

UIInterfaceOrientationIsLandscape(orientation)