0
首先 - 我讀了所有類似的話題,而不是他們爲我工作。 我有幾個視圖控制器。我改變他們的代碼:iPhone力的方向
- (void)flipToAzbukaMenu {
AzbukaMenuController *aAzbukaMenu = [[AzbukaMenuController alloc] initWithNibName:@"AzbukaMenu" bundle:nil];
[self setAzbukaMenuController:aAzbukaMenu];
[aAzbukaMenu release];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:window cache:NO];
[viewController.view removeFromSuperview];
[azbukaArcadeController.view removeFromSuperview];
[self.window addSubview:[azbukaMenuController view]];
[UIView commitAnimations];
}
另外我有適當的關鍵在plist,允許我在橫向模式啓動應用程序。當應用程序啓動時,它具有適當的方向(風景),但是當我改變我的視圖時,它變成肖像,並且只有在旋轉設備270度(不是90度)後才變爲景觀。如何強制應用以橫向模式顯示所有視圖?
UPD:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if ((interfaceOrientation==UIInterfaceOrientationPortrait)||(interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown))
{
return NO;
}
if ((interfaceOrientation==UIInterfaceOrientationLandscapeLeft)||(interfaceOrientation==UIInterfaceOrientationLandscapeRight))
{
return YES;
} else {
return YES;
}
}
更正 - 僅適用於來自UPD的代碼。 – Andoriyu 2010-08-10 00:43:02