WKWebView added as Subview is not resized on rotation in Swift WKWebView added as Subview is not resized on rotation in Swift ios ios

WKWebView added as Subview is not resized on rotation in Swift


I managed to solve the problem by using this line of code:

self._webView!.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight

:)


swift 3 version:

webView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]


I'm posting an answer for Objective-C, just in case if someone comes here looking for it

[self.webView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];