簡體   English   中英

UI界面方向iOS6

[英]UIinterface orientation ios6

我的代碼在iOS 5.1中工作正常,但在iOS 6中工作不正常。 我遇到方向問題。

我正在使用此代碼來控制方向

-(BOOL)shouldAutorotate
{
    return YES;

}
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight;
}

我想在橫向模式下顯示一個視圖控制器,在縱向模式下顯示另一個viewController

有人可以幫助我嗎?

謝謝

試試看這個

iOS 6提示和技巧升級您的應用程序

要么

嘗試在Main viewcontroller中添加以下代碼:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

return UIInterfaceOrientationLandscapeRight;

}

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)w {

return (NSUInteger)[application supportedInterfaceOrientationsForWindow:w] | (1<<UIInterfaceOrientationPortrait);

}

並且必須添加主viewcontroller如何:

[window setRootViewController: mainController];

代替

[window addSubview: mainController.view];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM