質問編集履歴
2
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -108,6 +108,22 @@
|
|
108
108
|
|
109
109
|
}
|
110
110
|
|
111
|
+
// UILongPressGestureRecognizerインスタンス作成
|
112
|
+
|
113
|
+
let longPressGesture = UILongPressGestureRecognizer(target: self, action: Selector(("longPressGesture")))
|
114
|
+
|
115
|
+
//デリゲート先を自分に設定する。
|
116
|
+
|
117
|
+
//longPressRecognizer.delegate
|
118
|
+
|
119
|
+
// 時間(デフォルト0.5秒)
|
120
|
+
|
121
|
+
longPressGesture.minimumPressDuration = 0.5
|
122
|
+
|
123
|
+
self.add.isUserInteractionEnabled = true
|
124
|
+
|
125
|
+
self.add.addGestureRecognizer(longPressGesture)
|
126
|
+
|
111
127
|
}
|
112
128
|
|
113
129
|
})
|
@@ -162,7 +178,7 @@
|
|
162
178
|
|
163
179
|
|
164
180
|
|
165
|
-
// UILongPressGestureRecognizerインスタンス作成
|
181
|
+
/*// UILongPressGestureRecognizerインスタンス作成
|
166
182
|
|
167
183
|
let longPressGesture = UILongPressGestureRecognizer(target: self, action: Selector(("longPress:")))
|
168
184
|
|
@@ -176,7 +192,7 @@
|
|
176
192
|
|
177
193
|
add.isUserInteractionEnabled = true
|
178
194
|
|
179
|
-
add.addGestureRecognizer(longPressGesture)
|
195
|
+
add.addGestureRecognizer(longPressGesture)*/
|
180
196
|
|
181
197
|
|
182
198
|
|
@@ -211,3 +227,7 @@
|
|
211
227
|
|
212
228
|
|
213
229
|
![イメージ説明](9d09ef1560e982bb581f38b1e916e085.png)
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
alert追加時に同時にlongpressの処理についても書いたの見て、実行して見たらlabelをタップした時にsignalbrtで落ちました。
|
1
画像の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -207,3 +207,7 @@
|
|
207
207
|
ラベルを長押しした時にalertを呼び出す実装をしたいです。
|
208
208
|
|
209
209
|
ですが、長押しした時にalertを呼び出せずに困っています。
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
![イメージ説明](9d09ef1560e982bb581f38b1e916e085.png)
|