iOS 7: modal view controller status bar is wrong color but normal view controllers are correct

前端 未结 9 1385
慢半拍i
慢半拍i 2021-02-05 06:20

I have an issue in iOS7 where a normal UINavigationController pushed view controller has the correct status bar text color for the UINavigationController navbar color (which is

9条回答
  •  爱一瞬间的悲伤
    2021-02-05 07:06

    This works. But I'm not happy with it because it a bit hacky. I think it's a bug that preferredStatusBarStyle is not called for modal view. Will ask Apple.

    - (void)viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:animated];
    
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
        [self setNeedsStatusBarAppearanceUpdate];
    }
    
    
    - (void)viewWillDisappear:(BOOL)animated
    {
        [super viewWillDisappear:animated];
    
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
        [self setNeedsStatusBarAppearanceUpdate];
    }
    

提交回复
热议问题