开发者社区> 问答> 正文

求解,ios7下 setNavigationBarHidden:YES 之后 页面会跟 Statusbar 叠在一起

screenshotscreenshot
求解,ios7下 setNavigationBarHidden:YES 之后 页面会跟 Statusbar 叠在一起

展开
收起
a123456678 2016-07-20 16:55:50 2498 0
1 条回答
写回答
取消 提交回答
  • - (void)viewDidLoad
    {
        [super viewDidLoad];
        NSString *verticalConstraint = @"V:|[v]";// for iOS6
        NSMutableDictionary *views = [NSMutableDictionary new];
        NSMutableArray *constraints = [NSMutableArray new];
        [views setObject:self.subview forKey:@"v"];
        if ([self respondsToSelector:@selector(topLayoutGuide)]) {
            // for iOS7
            [views setObject:self.topLayoutGuide forKey:@"topLayoutGuide"];
            verticalConstraint = @"V:[topLayoutGuide][v]";
        }
        [constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:verticalConstraint options:0 metrics:nil views:views]];
        // ... other constraints
        [self.view addConstraints:constraints];
        // Do any additional setup after loading the view from its nib.
    }
    2019-07-17 19:59:03
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
手淘iOS性能优化探索 立即下载
From Java/Android to Swift iOS 立即下载
深入剖析iOS性能优化 立即下载