質問編集履歴
4
やりたいことの不足分追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -81,3 +81,21 @@
|
|
81
81
|
}
|
82
82
|
|
83
83
|
```
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
###追記
|
90
|
+
|
91
|
+
UITextViewで意図的にリンクを張ったものに対する処理ではなく、
|
92
|
+
|
93
|
+
`Data Detectors`の`Link`をオンにした際、
|
94
|
+
|
95
|
+
サーバーから取得した文字列にURLがあった場合に自動でリンク化されたものを乗っ取り、
|
96
|
+
|
97
|
+
アプリ内WebViewで表示したいつもりです。
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
やはり自動リンクではなく、手動でリンクを付けたものしか開くように出来ないのでしょうか?
|
3
コードの更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,11 +42,9 @@
|
|
42
42
|
|
43
43
|
```Swift
|
44
44
|
|
45
|
-
i
|
45
|
+
class ViewController: UIViewController, UITextViewDelegate {
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
|
50
48
|
|
51
49
|
@IBOutlet weak var textView: UITextView!
|
52
50
|
|
@@ -68,9 +66,13 @@
|
|
68
66
|
|
69
67
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
70
68
|
|
71
|
-
let
|
69
|
+
let touch = touches.first
|
72
70
|
|
71
|
+
let touchPoint = touch?.location(in: self.view)
|
72
|
+
|
73
|
+
let touchPoint2 = self.textView.convert(touchPoint!, from: self.view)
|
74
|
+
|
73
|
-
print(
|
75
|
+
print(touchPoint2)
|
74
76
|
|
75
77
|
}
|
76
78
|
|
2
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -31,3 +31,51 @@
|
|
31
31
|
`Xcode8`
|
32
32
|
|
33
33
|
`Swift3`
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
###コード
|
42
|
+
|
43
|
+
```Swift
|
44
|
+
|
45
|
+
import UIKit
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
class ViewController: UIViewController, UITextViewDelegate {
|
50
|
+
|
51
|
+
@IBOutlet weak var textView: UITextView!
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
override func viewDidLoad() {
|
56
|
+
|
57
|
+
super.viewDidLoad()
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
textView.delegate = self
|
62
|
+
|
63
|
+
textView.layer.borderWidth = 1.0
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
70
|
+
|
71
|
+
let location = touches.first?.location(in: textView)
|
72
|
+
|
73
|
+
print(location!)
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
```
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,10 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
またより良い方法等あれば教えてください。
|
26
|
+
|
27
|
+
|
28
|
+
|
25
29
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
26
30
|
|
27
31
|
`Xcode8`
|