iOS 7 status bar back to iOS 6 default style in iPhone app?

前端 未结 25 863
终归单人心
终归单人心 2020-11-22 05:48

In iOS 7 the UIStatusBar has been designed in a way that it merges with the view like this:

\"GUI

25条回答
  •  醉话见心
    2020-11-22 06:31

    I have viewed many many many many and many tutorials to fix this darn problem. But none of them works! Here is my solution, and it works for me:

    if( [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f ) {
        float statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
        for( UIView *v in [self.view subviews] ) {
            CGRect rect = v.frame;
            rect.origin.y += statusBarHeight;
            v.frame = rect;
        }
    }
    

    The logic is simple. I shift all children views on the self.view with 20 pixels. That's all. Then, the screenshot will display just like as iOS 6 did. I hate the iOS7 status bar! ~"~

提交回复
热议问题