How do you prevent Notification Center in games?

后端 未结 2 638
天命终不由人
天命终不由人 2020-12-19 13:14

In iOS7, swiping up from the bottom of the screen or down from the top of the screen slides a \"glass screen\" on top of the app you are using. In many games, it is very fru

2条回答
  •  清歌不尽
    2020-12-19 14:05

    I've set statusBar is initially hidden to YES in Info.plist , but it failed to achieve the result I wanted. Setting UIApplication statusBarHidden to YES does not work in iOS 7 got me the answer I needed:

    - (void)viewDidLoad 
    {
     [super viewDidLoad];
    
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
    {
        [self prefersStatusBarHidden];
        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
    }
    else
    {
          // iOS 6
          [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
    }
    }
    
    - (BOOL)prefersStatusBarHidden {
      return YES;
    }
    

    This, as per 21/10/2013, works fine.

提交回复
热议问题