UIWebView doesn't scroll to the bottom of the

2019-08-22 00:56发布

I have a UIWebView inside a normal UIViewController. The content of the UIWebView is programming/dynamically created in my program, and it could be very long (multiple table rows). Somehow, after loading, the page won't scroll more then one and half screen of content when swipe on the screen. Because of that I can only see the beginning few rows of data, but not the many others after them. Why is that?

1条回答
别忘想泡老子
2楼-- · 2019-08-22 01:33

If you can't scroll to the bottom end properly using UIWebView:

1) One way (Programmatically) to solve the problem is using proper autosizing to UIWebView.

self.webView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin ;

enter image description here

2) Other way (Interface Builder) to solve the problem is using proper autosizing to UIWebView. Go to Interface Builder->Web View->Size Inspector and tick autosizing parts in all places (As seen on Image above)

查看更多
登录 后发表回答