On iOS8, displaying my app in landscape mode will hide the status bar but on iOS 7 the status bar is displayed on both orientations

后端 未结 10 1508
暗喜
暗喜 2020-12-02 11:04

I want the status bar to be displayed in both orientations in iOS 8; it\'s being displayed properly in iOS 7.

navigationController.isNavigationBarHidden

10条回答
  •  我在风中等你
    2020-12-02 11:11

    We solved this by forcing an orientation change unseen by the user. In the first view controller that loads, add:

    - (void)viewWillAppear:(BOOL)animated
    {
        NSNumber *orientationLeft = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
        NSNumber *orientationRight = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
        [[UIDevice currentDevice] setValue:orientationLeft forKey:@"orientation"];
        [[UIDevice currentDevice] setValue:orientationRight forKey:@"orientation"];
    }
    

提交回复
热议问题