如何鎖定設備上的更改方向?如何鎖定設備上的方向改變?
我試圖用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationLandscapeRight;
}
這
- (void)viewDidAppear:(BOOL)animated
{
[self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight];
[super viewDidAppear:animated];
}
但沒有工作時,我使用的設備。當應用程序在模擬器上運行時,效果很好。
模擬器有iOS 6和設備5.1.1。我做錯了什麼?
工作UIInterfaceOrientationLandscapeRight不是BOOL,它只是UIInterfaceOrientation枚舉的成員。所以你應該會得到一個編譯器錯誤。你想要做的就是回到UIInterfaceOrientation == UIInterfaceOrientationLandscapeRight,如果傳遞的interfaceOrientation是測試你需要與否什麼條件的結果。 – 2013-02-13 10:31:49