2011-06-06 72 views
1

對於我的iPad應用程序,我打算禁用自動旋轉。不過,我聽說蘋果會拒絕該應用程序,因爲他們預計該應用程序至少可以旋轉180度。有誰之前經歷過這個嗎?這個真相嗎?如何僅允許180度的自轉?

在任何情況下,任何人都可以告訴我如何將自旋設置爲肖像模式?即只允許旋轉180度。

對此的任何幫助將不勝感激。

感謝

+2

「有沒有人經歷過這個?」看起來答案是肯定的:http://www.iphonedevsdk.com/forum/iphone-sdk-development/45376-ipad-app-rejected-due-autorotation-problems.html – 2011-06-06 14:53:00

回答

2

在您的視圖控制器,覆蓋shouldAutorotateToInterfaceOrientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations. 
    return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown); 
} 
+1

或者更簡單的寫法,'return UIInterfaceOrientationIsPortrait( interfaceOrientation);' – 2011-06-06 19:52:39

+0

謝謝你們的幫助! – Zhen 2011-06-07 06:54:41

1

答案是肯定的,如果你只是簡單的BOOL設置爲否在shouldAutoRotateToInterfaceOrientation。我已經看到其他遊戲應用的色調,儘管只允許橫向或縱向,但至少180度,我猜。