質問編集履歴

3

jQueryは動作していることを表すHTMLに変更しました

2019/03/01 05:14

投稿

hakase
hakase

スコア107

test CHANGED
File without changes
test CHANGED
@@ -27,6 +27,8 @@
27
27
  </div>
28
28
 
29
29
  <script>
30
+
31
+ $('p').append('def');
30
32
 
31
33
  $('div').load('test2.html');
32
34
 

2

htmlの表示自体は上手くいっていることがわかるhtmlに修正しました

2019/03/01 05:14

投稿

hakase
hakase

スコア107

test CHANGED
File without changes
test CHANGED
@@ -19,6 +19,8 @@
19
19
  </head>
20
20
 
21
21
  <body>
22
+
23
+ <p>abc</p>
22
24
 
23
25
  <div>
24
26
 

1

swiftを追加しました

2019/03/01 05:12

投稿

hakase
hakase

スコア107

test CHANGED
File without changes
test CHANGED
@@ -35,3 +35,69 @@
35
35
  </html>
36
36
 
37
37
  ```
38
+
39
+ ```swift
40
+
41
+ import UIKit
42
+
43
+ import WebKit
44
+
45
+ import UserNotifications
46
+
47
+
48
+
49
+ class ViewController: UIViewController,WKUIDelegate,WKNavigationDelegate,WKScriptMessageHandler{
50
+
51
+ var webView:WKWebView!
52
+
53
+ override func viewDidLoad() {
54
+
55
+ super.viewDidLoad()
56
+
57
+ // Do any additional setup after loading the view, typically from a nib.
58
+
59
+ let webConfiguration = WKWebViewConfiguration()
60
+
61
+ let userController = WKUserContentController()
62
+
63
+ userController.add(self, name: "init")
64
+
65
+ webConfiguration.userContentController = userController
66
+
67
+
68
+
69
+ webView=WKWebView(frame:CGRect(x:0,y:0,width:self.view.frame.width,height:self.view.frame.height), configuration: webConfiguration)
70
+
71
+ webView.uiDelegate=self
72
+
73
+ webView.navigationDelegate = self
74
+
75
+ webView.scrollView.bounces=false
76
+
77
+
78
+
79
+ self.view.addSubview(webView)
80
+
81
+
82
+
83
+ let path = Bundle.main.path(forResource:"test", ofType: "html")!
84
+
85
+ let url = URL(fileURLWithPath: path)
86
+
87
+ let urlRequest = URLRequest(url: url)
88
+
89
+ webView.load(urlRequest)
90
+
91
+ }
92
+
93
+
94
+
95
+ func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
96
+
97
+ webView.evaluateJavaScript(String(format:"Init(%@,'%@');",Static.id,Static.passCode))
98
+
99
+ }
100
+
101
+ }
102
+
103
+ ```