2011-08-09 130 views
1

我是一個新的bie,用於堆疊流和iphone開發,我只需在橫向模式下啓動我的應用程序。爲此,我在信息中設置了鍵。 plist和寫在方向delegete ..但結果仍然是相同的。我做了一個巨大的研究,但尚未成功..我的Xcode版本是3.2.26,我的基本模板是基於tabbar ..非常感謝你您有關於我的問題的一些建議,真誠僅在橫向模式下啓動應用程序,並在橫向模式下鎖定應用程序

謝謝

普里亞(印度)

回答

1

你需要這樣做

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

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

} 
+0

我已經這樣做,但仍:(:((( –

+0

它肯定是工作。你把代碼放到你的視圖控制器中了嗎? – Vanya

+0

按照我的建議。您錯過了您的info.plist文件中的啓動方向。 –

0

首先定義你的Info.plist文件以下鍵值對:

UIInterfaceOrientation UIInterfaceOrientationLandscapeLeft 

或UIInterfaceOrientationLandscapeRight或定義景觀正確的方向初始啓動後在所有的控制器在以下定義shouldAutorotateToInterfaceOrientation方式:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 
相關問題