How can you disable the iOS Notification Center within your App?

前端 未结 4 1069
青春惊慌失措
青春惊慌失措 2020-12-28 14:55

If you have a full screen iOS app and you want to prevent the notification center from being pulled down, can you and how?

Also can you block notification alerts or

4条回答
  •  借酒劲吻你
    2020-12-28 15:09

    I built a very simple code snippet to address this issue programatically. I have a timer set-up in my app delegate that runs every .2 seconds each time it runs it keeps moving the status bar orientation so it doesn't impact the game play. I haven't experienced the annoying notification center in my app since! The only issue is the volume control rotates constantly and might be annoying but it's less annoying than notification center

    int tick=0;
    
    -(void)toggleNC
    {
         [[UIApplication sharedApplication] setStatusBarHidden:YES]; 
        tick++;
        if (tick==1)
        {
         [[UIApplication sharedApplication]   setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];
        }
        if (tick==2){
             [[UIApplication sharedApplication]     setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
        }
        if (tick==3){
          [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
       }
        if (tick==4){
            [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown];
            tick=0;
    
        }
    }
    

提交回复
热议问题