适配iOS7状态栏高度问题

来源:互联网 发布:qt 4.8.4 windows下载 编辑:程序博客网 时间:2024/06/07 01:20
 if( [[[UIDevicecurrentDevice] systemVersion] floatValue] >= 7.0f ) {
        float statusBarHeight = [[UIApplicationsharedApplication] statusBarFrame].size.height;
        for( UIView *v in [self.window subviews] ) {
            CGRect rect = v.frame;
            rect.origin.y += statusBarHeight;
            v.frame = rect;
        }
        UIView *statusBarView = [[[UIViewalloc]initWithFrame:CGRectMake(0, 0, 320, 20)]autorelease];
        statusBarView.backgroundColor = [UIColor colorWithHex:0xff7488];
        [self.window addSubview:statusBarView];
    }
原创粉丝点击