CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame]; CGFloat rectStatusHeight = rectStatus.size.height; NSLog(@"status width - %f", rectStatus.size.width); // 宽度 NSLog(@"status height - %f", rectStatus.size.height); // 高度 [rootView mas_makeConstraints:^(MASConstraintMaker *make) { if (@available(iOS 11.0, *)) { make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft); make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight); make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop); make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom); } else { make.top.equalTo(@(rectStatusHeight)); make.left.right.bottom.equalTo(0); } }];