IOS 4.3 hide status bar permanently

后端 未结 5 2164
醉酒成梦
醉酒成梦 2020-12-05 04:24

I\'m trying to hide the status bar in iOS 4.3 now that setStatusBarHidden:animated: is deprecated:

[[UIApplication sharedApplication] setStatusB         


        
相关标签:
5条回答
  • 2020-12-05 05:03

    But how about [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

    See the UIApplication reference.

    0 讨论(0)
  • 2020-12-05 05:10

    Try this:

    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
    

    From Apple Class Reference:

    setStatusBarHidden:withAnimation:

    Hides or shows the status bar, optionally animating the transition. - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation Parameters

    hidden YES to hide the status bar, NO to show the status bar.

    animation A constant that indicates whether there should be an animation and, if one is requested, whether it should fade the status bar in or out or whether it should slide the status bar in or out.

    0 讨论(0)
  • 2020-12-05 05:10

    seStatusBarHidden seems to be deprecated and not working anymore.

    Use prefersStatusBarHidden on your view controller instead

    - (BOOL)prefersStatusBarHidden
    {
        return YES;
    }
    
    0 讨论(0)
  • 2020-12-05 05:15

    The new method is:

    - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation
    

    Works the same except the animation type is an enum now to support various animation types.

    0 讨论(0)
  • 2020-12-05 05:26
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    
    0 讨论(0)
提交回复
热议问题