1

風景のみをサポートするアプリをセットアップしました。iPad シミュレータ デバイス OrientationLandscapeRight の場合、nib ファイルからアプリを起動すると、UIInterfaceOrientationLandscapeRight から UIInterfaceOrientationLandscapeLeft に高速で自動回転します。

-(void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation{           
   NSLog(@"%d%d%d%d",UIInterfaceOrientationPortrait
                    ,UIInterfaceOrientationPortraitUpsideDown
                    ,UIInterfaceOrientationLandscapeLeft
                    ,UIInterfaceOrientationLandscapeRight);
   NSLog(@"%d",oldStatusBarOrientation);}

nib ファイルからの起動のログ:

2013-09-11 11:12:33.235 Wenxianji[925:15203] 1243

2013-09-11 11:12:33.238 文仙寺[925:15203] 1

2013-09-11 11:12:33.251 文仙寺[925:15203] 1243

2013-09-11 11:12:33.253 Wenxianji[925:15203] 3

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      self.window.backgroundColor = [UIColor whiteColor];

     _spvc   = [[MySplitViewController alloc] init];
     _master = [[MasterViewController alloc] init];
     _detail = [[DetailViewController alloc] init];

     _spvc.delegate = _detail;
     _spvc.viewControllers = @[_master, _detail];

     _master.detailViewController = _detail;

     [self.window setRootViewController:_spvc];
     [self.window makeKeyAndVisible];
      return YES;}

プログラム時のログ:

2013-09-11 11:26:34.757 Wenxianji[960:15203] 1243

2013-09-11 11:26:34.760 文仙寺[960:15203] 1

4

1 に答える 1

0
 -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

 // enables only landscapeLeft and landscapeRight orientations

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

1.向きを設定する必要があるすべてのviewControllerでこの関数を使用します。

2.サポートされている向きに plist を調整します。

3. プロジェクト -> ターゲット -> 概要 -> iphone/ipad 展開情報でサポートされている向きを調整します。

4. プロパティ インスペクターでビュー (例: ルート ビュー) の向きを調整します。

問題が解決しない場合はお知らせください。

于 2013-09-11T09:07:48.980 に答える