How do you prevent Notification Center in games?

后端 未结 2 611
天命终不由人
天命终不由人 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 13:47

    To get the same behaviour in iOS 11, you must implement preferredScreenEdgesDeferringSystemGestures on your view controller:

    - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures {
        return UIRectEdgeAll;
    }
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题