質問編集履歴
4
やりたいことの不足分追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -39,4 +39,13 @@
|
|
39
39
|
}
|
40
40
|
|
41
41
|
}
|
42
|
-
```
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
###追記
|
46
|
+
UITextViewで意図的にリンクを張ったものに対する処理ではなく、
|
47
|
+
`Data Detectors`の`Link`をオンにした際、
|
48
|
+
サーバーから取得した文字列にURLがあった場合に自動でリンク化されたものを乗っ取り、
|
49
|
+
アプリ内WebViewで表示したいつもりです。
|
50
|
+
|
51
|
+
やはり自動リンクではなく、手動でリンクを付けたものしか開くように出来ないのでしょうか?
|
3
コードの更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,9 +20,8 @@
|
|
20
20
|
|
21
21
|
###コード
|
22
22
|
```Swift
|
23
|
-
import UIKit
|
24
|
-
|
25
23
|
class ViewController: UIViewController, UITextViewDelegate {
|
24
|
+
|
26
25
|
@IBOutlet weak var textView: UITextView!
|
27
26
|
|
28
27
|
override func viewDidLoad() {
|
@@ -33,8 +32,10 @@
|
|
33
32
|
}
|
34
33
|
|
35
34
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
35
|
+
let touch = touches.first
|
36
|
-
let
|
36
|
+
let touchPoint = touch?.location(in: self.view)
|
37
|
+
let touchPoint2 = self.textView.convert(touchPoint!, from: self.view)
|
37
|
-
print(
|
38
|
+
print(touchPoint2)
|
38
39
|
}
|
39
40
|
|
40
41
|
}
|
2
コードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,4 +14,28 @@
|
|
14
14
|
|
15
15
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
16
16
|
`Xcode8`
|
17
|
-
`Swift3`
|
17
|
+
`Swift3`
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
###コード
|
22
|
+
```Swift
|
23
|
+
import UIKit
|
24
|
+
|
25
|
+
class ViewController: UIViewController, UITextViewDelegate {
|
26
|
+
@IBOutlet weak var textView: UITextView!
|
27
|
+
|
28
|
+
override func viewDidLoad() {
|
29
|
+
super.viewDidLoad()
|
30
|
+
|
31
|
+
textView.delegate = self
|
32
|
+
textView.layer.borderWidth = 1.0
|
33
|
+
}
|
34
|
+
|
35
|
+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
36
|
+
let location = touches.first?.location(in: textView)
|
37
|
+
print(location!)
|
38
|
+
}
|
39
|
+
|
40
|
+
}
|
41
|
+
```
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
[こちらのサイト](http://blog.kishikawakatsumi.com/entry/20130605/1370370925)を見てみたのですが、
|
11
11
|
Objective-Cで書かれていることもあり理解できずにいます。
|
12
12
|
|
13
|
+
またより良い方法等あれば教えてください。
|
14
|
+
|
13
15
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
14
16
|
`Xcode8`
|
15
17
|
`Swift3`
|