webView、scrollView、TableView,为了防止滚动时出现偏移,底部黑框问题等

if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {self.automaticallyAdjustsScrollViewInsets = NO;}

或者:_webView.opaque =NO;

具体场景如下:

- (void)viewDidLoad {

    self.title = @"菜品详情页";

    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];

    //加载web页面

    [self addWebViewDemo];

}

-(void)addWebViewDemo{

    _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 64, JYEScreenWidth, JYEScreenHeight-64)];

    

    NSURL *url = [[NSURL alloc]initWithString:@"http://www.baidu.com"];

    NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url];

    [_webView loadRequest:request];

    

    //if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {self.automaticallyAdjustsScrollViewInsets = NO;}

    _webView.opaque =NO;

    _webView.scalesPageToFit = YES;

    [self.view addSubview:_webView];

}

原文地址:https://www.cnblogs.com/lrr0618/p/5203667.html