2013-03-22 167 views
0

當我的應用程序在iPhone上啓動時,它會以縱向顯示,因爲它應該如此。當它以iPhone模式在iPad上啓動時,如果以這種方式旋轉,它將以橫向顯示。這是我的代碼:在iPad上的iPhone模式下顯示應用程序時的應用程序

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

-(BOOL)shouldAutorotate { 
    return NO; 
} 
+0

設置項目設置內支撐定向在摘要部分爲縱向只 – nsgulliver 2013-03-22 16:11:45

回答

0

對於iOS 6,你有沒有嘗試:

- (NSUInteger)supportedInterfaceOrientations { 
return UIInterfaceOrientationMaskPortrait; 
} 
0

在項目Info.plist文件,從支撐取向列表中刪除的景觀標誌。

0

在Xcode中選擇一個你的目標,然後在摘要選項卡下確保你只選擇了UIpotrait方向,並且其餘所有選項都未選中,然後選擇info選項卡並在「支持的接口方向」行中看到它應該只有UIpotrait取向。現在打開你的委託文件和iOS5的這種方法可行

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); }

但這種方法已經廢棄了iOS6的覆蓋它iOS6的

- (BOOL)shouldAutorotate {

return YES; 

}

- (NSUInteger)supportedInterfaceOrientations {

return UIInterfaceOrientationMaskPortrait; 

} - (NSUInteger)應用:(UIApplication的*)應用supportedInterfaceOrientationsForWindow:(一個UIWindow *)窗口{

return UIInterfaceOrientationMaskPortrait; 

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

return UIInterfaceOrientationPortrait; 

}

相關問題