質問編集履歴
1
コードの書き足し
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
しかし該当するラベルを押しても何も反応しません。
|
3
3
|
view全体を押せば、print("yes")は出るので、taorecognizer自体は機能していると思われます。
|
4
4
|
```swift
|
5
|
+
var isTouched: Bool = false
|
6
|
+
var notes:[UILabel] = []
|
7
|
+
|
8
|
+
for (index,url) in urls.enumerated() {
|
9
|
+
|
10
|
+
note = UILabel()
|
11
|
+
note.isUserInteractionEnabled = true
|
12
|
+
note.tag = index
|
13
|
+
notes.append(note)
|
14
|
+
|
15
|
+
|
16
|
+
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(viewTapped))
|
17
|
+
note.addGestureRecognizer(tapGestureRecognizer)
|
18
|
+
|
19
|
+
}
|
20
|
+
|
5
21
|
@objc func viewTapped(_ sender: UITapGestureRecognizer) {
|
6
22
|
print("yes")
|
7
23
|
if !isTouched {
|