2012-12-28 67 views
1

我在我的應用程序中使用了splitviewController。該應用程序的方向嚴格設置爲橫向。我已經在構建設置中正確完成了它。如何在iOS5中旋轉視圖?

當我在iOS 5.1或更高版本中運行我的應用程序時,它很好地工作。但是當我在iOS 5或更低版本中運行我的應用程序時,應用程序的方向不會更改爲橫向。這是一個大問題。有沒有解決方法?

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

嘗試'收益率(( interfa ceOrientation == UIInterfaceOrientationLandscapeLeft)|| (interfaceOrientation == UIInterfaceOrientationLandscapeRight));' – howanghk

+0

在哪裏添加這一行? –

回答

0

簡單。插入以下代替:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 
} 
0

你應該

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

使用此更換你的

return (interfaceOrientation == UIInterfaceOrientationPortrait); 

聲明中的所有viewControllersorientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
}