How To Put A WKWebView Inside A UIScrollView In iOS (UIKit / Swift)

When you embed a WKWebView inside a UIScrollView in iOS, the size of the WKWebView may not change as expected because of conflicting constraints. By default, the WKWebView may have its own intrinsic content size based on the content being displayed, while the UIScrollView may try to adjust its content size based on its constraints.


Listening for the WKWebView to complete loading its content, and then using JavaScript to calculate the height of the WKWebView and adjust the size of the WKWebView and the content size of the UIScrollView is a common approach for resolving these types of issues.

You can clone the full project here

Comments

Popular posts from this blog

How To Check If Your Android Phone Is Official Or Rooted

Android Reverse Engineering - Beginners Guide To Smali Coding

Conquering macOS Upgrades: A Guide for iOS App Developers