void SetupControl() { _navigationDelegate = new FormsNavigationDelegate(this); _contentController = new WKUserContentController(); _contentController.AddScriptMessageHandler(this, "invokeAction"); _configuration = new WKWebViewConfiguration { UserContentController = _contentController }; if (Element.ApplicationNameForUserAgent != null && Element.ApplicationNameForUserAgent.Length > 0) { _configuration.ApplicationNameForUserAgent = Element.ApplicationNameForUserAgent; } var wkWebView = new WKWebView(Frame, _configuration) { Opaque = false, UIDelegate = this, NavigationDelegate = _navigationDelegate }; FormsWebView.CallbackAdded += OnCallbackAdded; SetNativeControl(wkWebView); OnControlChanged?.Invoke(this, wkWebView); }
void SetupControl() { _navigationDelegate = new FormsNavigationDelegate(this); _contentController = new WKUserContentController(); _contentController.AddScriptMessageHandler(this, "invokeAction"); _configuration = new WKWebViewConfiguration { UserContentController = _contentController, }; _configuration.ProcessPool = _processPool; var wkWebView = new WKWebView(Frame, _configuration) { Opaque = false, UIDelegate = this, NavigationDelegate = _navigationDelegate, }; FormsWebView.CallbackAdded += OnCallbackAdded; try { //Autoresize after rotation. Wrapped in try catch with no handling since untested wkWebView.ContentMode = UIViewContentMode.ScaleAspectFit; wkWebView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; wkWebView.SizeToFit(); if (wkWebView.ScrollView != null) { wkWebView.ScrollView.Bounces = false; } } catch { /*Do nothing right now*/ } SetNativeControl(wkWebView); OnControlChanged?.Invoke(this, wkWebView); }
void SetupControl() { _navigationDelegate = new FormsNavigationDelegate(this); _contentController = new WKUserContentController(); _contentController.AddScriptMessageHandler(this, "invokeAction"); _configuration = new WKWebViewConfiguration { UserContentController = _contentController }; var wkWebView = new WKWebView(Frame, _configuration) { Opaque = false, UIDelegate = this, NavigationDelegate = _navigationDelegate }; FormsWebView.CallbackAdded += OnCallbackAdded; SetNativeControl(wkWebView); OnControlChanged?.Invoke(this, wkWebView); }