0

向きが横向きに設定されており、iPhone シミュレーターがアプリを読み込んで横向きモードで起動します。iOS6以降、上記のコードは写真を横向きモードではなく縦向きモードでロードします。お知らせ下さい。

編集:問題はここから始まります:

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"480x320-background.png"]]];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)anInterfaceOrientation{
    return anInterfaceOrientation==UIInterfaceOrientationLandscapeLeft || anInterfaceOrientation==UIInterfaceOrientationLandscapeRight;
}
4

4 に答える 4

1

iOS6shouldAutorotateToInterfaceOrientationでは非推奨です。と を使用する必要がsupportedInterfaceOrientationsありshouldAutorotateます。

于 2012-12-31T10:32:14.500 に答える
0

iOS 6では、ローテーション方法が変更されています。このメソッドを実装し、YESを返す必要があります。

- (BOOL) shouldAutorotate 
{
  return YES;
}
于 2012-12-31T11:52:13.797 に答える
0

それが私の問題を解決したものです:下didFinishLaunchingWithOptions [window setRootViewController:headiPhone];

于 2013-01-01T06:48:14.950 に答える
0

IOS6 の自動回転の問題を修正するには、次の手順を実行します。

内部AppDelegate.mファイル

以下を追加

if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
    // Note : addSubView doesn't work on IOS6
    [window addSubview: viewController.view];
}
else
{
    // For IOS6, use this method
    [window setRootViewController:viewController];
}

それ以外の

[window addSubview: viewController.view];

内部RootViewController.mファイル

// IOS6 の場合、代わりにsupportedInterfaceOrientations&を使用しますshouldAutorotateshouldAutorotateToInterfaceOrientation

- (NSUInteger) supportedInterfaceOrientations
{
  return UIInterfaceOrientationMaskLandscape;   
}

- (BOOL) shouldAutorotate 
{
  return YES;
}
于 2012-12-31T11:47:54.370 に答える