//在 root ViewController 中,viewDidload 函式裡增加
if([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
{
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
else
{
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
// 增加此函式
- (BOOL)prefersStatusBarHidden
{
return YES;
}
如此即可相容 iOS6 & iOS7 的情況。
沒有留言:
張貼留言