2011-08-03 55 views
0

這一個讓我把我的頭髮撕掉。我的iPad應用的設置如下:UIView始終以縱向模式加載

在我的應用程序委託我有這樣的:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 
在我的info.plist

我:

Initial Interface Orientation = UIInterfaceOrientationLandscapeLeft 

在我的第一個視圖控制器被加載從應用程序的委託,我有:

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

在我的第二個視圖控制器我有:

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

最後,在界面構建器中將兩個筆尖中的視圖設置爲橫向。應用程序開始在橫向模式下,有一個按鈕,按下時第二視圖分配給第一個觀點:

self.view = secondView.view; 

的問題是,即使一切都在景觀新視圖總是加載在縱向模式?請任何幫助,這將非常非常感激!

回答

1

這是你想改變的一點。這是允許的初始方向。改變它以適應您的需求。

它位於目標設置的摘要選項卡中。

Xcode 4

或者。如果你不使用的Xcode 4,但 - 你可以在Info.plist中設定的方向:

Xcode 3

所以你可以看到所有的鍵:

Xcode 3 All keys

+0

感謝回覆。你的屏幕截圖是xCode 4,你知道它在xCode 3中的位置嗎? – Peter

+1

@Peter - 查看Info.plist中的'Supported interface orientations'鍵。 – Abizern

+0

@Peter,它是Xcode,而不是xCode。 :-) – Moshe

相關問題