Is there a way to turn off the notificationCenter in iOS game using cocos2d-x? Suppose in my game, there are objects which have to be dragged from the top. The notificationCenter interrupts in between. Please anyone here tell me how to turn off the notification center when the game runs.
3 Answers
If by notificationCenter your mean CCNotificationCenter then you can call CCNotificationCenter::purgeNotificationCenter to remove all the observers or CCNotificationCenter::removeAllObservers(target) to stop notifications for a specific observer.

- 438
- 2
- 13
-
i mean about that drop slide down bar.That notification bar.Its not working with this code – Rajan Maheshwari Jan 30 '14 at 17:55
-
Ok. I guess you mean the status bar. To disable the status bar check out those answers http://stackoverflow.com/questions/4264072/how-to-hide-status-bar-in-iphone-application http://stackoverflow.com/questions/12661031/how-to-hide-a-status-bar-in-ios – Laurent Zubiaur Jan 31 '14 at 08:13
No, the Notification Center is a system level feature. And iOS is not exposed any API to turn it off in some applications.

- 157
- 10
Notification center could not be disabled in the app.
According to How to disable the "drag down to view Notifications" feature?, the only way to stop the Notification Center from immediately appearing is to hide your app's status bar, and even then the 'tab' of the NC will stay appear.
Like Multitasking Gestures in iOS5, you cannot stop this behavior and must instead rethink how your apps work to suit Apple's changes.
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES
withAnimation:UIStatusBarAnimationSlide];
}
- (BOOL)prefersStatusBarHidden {
return YES;
}