1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| using System;
| using WebKit;
|
| namespace Shared
| {
| public class WebView:View
| {
|
| private WKWebView uiWebView
| {
| get
| {
| return this.uiView as WKWebView;
| }
| set
| {
| this.uiView = value;
| }
| }
|
|
| public WebView ()
| {
| //默认布局,宽高为0的话会异常
| var mFrame = new CoreGraphics.CGRect(base.X, base.Y, 10, 10);
| this.uiWebView = new WKWebView(mFrame, new WKWebViewConfiguration()) { };
| }
|
| public void Load(string url)
| {
| uiWebView.LoadRequest ( Foundation.NSUrlRequest.FromUrl ( Foundation.NSUrl .FromString(url)));
| }
|
| }
| }
|
|