iOS-混合开发去掉状态栏高度
2018-11-29 本文已影响7人
鱼与熊掌不能兼得
第一步:在pist文件添加 View controller-based status bar appearance 字段并设为YES
第二步:在controller中添加如下代码
-
(void)viewWillAppear:(BOOL)animated
{
// View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
// you can do so here.
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7){
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = -20;
viewBounds.size.height = viewBounds.size.height;
self.webView.frame = viewBounds;
}[super viewWillAppear:animated];
这样就完美的去掉的状态栏的高度