简体   繁体   English

Objective-C:设置UIWebView的ScrollView

[英]Objective-C: Set UIWebView's ScrollView

I am trying to set the webview's scrollview using the code below but it disabled the scrolling/interaction of the webview. 我正在尝试使用以下代码设置网络视图的滚动视图,但它禁用了网络视图的滚动/交互。

[webView sizeToFit];
    webView.scrollView.scrollEnabled = YES;
    webView.scrollView.contentSize = CGSizeMake(375, rfqWeb.scrollView.contentSize.height + 700);
    rfqWeb.userInteractionEnabled = YES;

If you want to change the "scrollable size", I suggest to do: 如果要更改“可滚动大小”,我建议您执行以下操作:

- (void)setInsetsTop:(CGFloat)top bottom:(CGFloat)bottom {
    self.webview.frame = CGRectMake(0.0f, 0.0f, self.view.frame.size.width, self.view.frame.size.height - bottom);

    [[self.webview scrollView] setContentInset:UIEdgeInsetsMake(top, 0, bottom, 0)];
}

I call it from another class 我从另一个班级叫它

[htmlWebViewController setInsetsTop:0.0f bottom:44.0f];

If you use it in the same class just use 如果您在同一课程中使用它,只需使用

[self setInsetsTop:0.0f bottom:44.0f];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM