在 iOS 11 使用 webview 发现顶部会有一个空白条,怎么也去不掉,通过设置 contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever 就可以解决了,具体的代码如下:
//
// ViewController.m
// webView
//
// Created by exchen on 18/7/14.
// Copyright © 2018年 exchen. All rights reserved.
//
#import "ViewController.h"
@interface ViewController () <UIWebViewDelegate>
@property(nonatomic, strong) UIWebView* webView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect screen = [[UIScreen mainScreen] bounds];
//添加 UIWebView
self.webView = [[UIWebView alloc] initWithFrame: CGRectMake(0, 0, screen.size.width, screen.size.height)];
[self.view addSubview: self.webView];
NSURL * url = [NSURL URLWithString: @"https://www.exchen