@Sergey Kuryanov, . UIWebView loadHTMLString, , , , UIWebView.
, , - . @clearwater82 : UIView
Swift 3, .
, UIWebView loadHTMLString. , UIWebView , HTML . " ". , , :
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
NotificationCenter.default.addObserver(
self,
selector: #selector(self.orientationChanged(notification:)),
name: NSNotification.Name.UIDeviceOrientationDidChange,
object: nil
)
func orientationChanged(notification: Notification) {
self.webView.loadHTMLString(self.htmlText, baseURL: nil)
}
deinit {
NotificationCenter.default.removeObserver(self)
UIDevice.current.endGeneratingDeviceOrientationNotifications()
}
:
self.htmlText is a variable containing the HTML text I want to load, which I added to my custom view.- use
UIDevice.current.endGeneratingDeviceOrientationNotifications()was appropriate for my situation, maybe this is not for your
That's all greetings
source
share