Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
467 views
in Technique[技术] by (71.8m points)

ios7 - How do you prevent Notification Center in games?

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 frustrating.

As a user, you can turn off this behavior in apps, but this is a system-wide change.

Angry Birds has small triangles pop up when a top/bottom swipe is detected, which is not a perfect fix, but something already.

Is there any better solution? What API/call to use?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...