2012-08-17 93 views
2

我創建了一個只有三個視圖的小應用程序。我只選擇了LandscapeRight方向。在iOS模擬器中,只有第一個視圖出現在橫向中。其他意見是肖像。我可以旋轉模擬器,但故事板佈局隨之旋轉,並且不能正確顯示。 info.plist文件只有(Landscapre Right)方向項。ios模擬器方向錯誤第二

親切的問候 泰迪

回答

1

像什麼威爾森說了,這是小麻煩,但你必須添加下面的代碼

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ 

return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight); 

} 

不過,我也想補充一點,你必須按順序加入到這個每個單獨視圖控制器爲它的其他六旋轉也是如此。

例如,假設我有viewcontroller_1和viewcontroller_2,我必須進入控制器的兩個.m文件並添加以下代碼。如果你不這樣做,它可能不會爲其中一個視圖旋轉。

+0

謝謝。我將其他視圖控制器作爲子視圖添加到初始視圖控制器,因此它們沒有自己的視圖控制器 – user1607498 2012-08-17 23:14:32

0

是的,這很煩人,但它添加到您的.m文件和它的作品

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ 

return (toInterfaceOrientation ==  UIInterfaceOrientationLandscapeRight); 

}