回答編集履歴

1

minimumPressDurationを追加

2019/07/17 12:32

投稿

k2moons
k2moons

スコア184

test CHANGED
@@ -6,11 +6,13 @@
6
6
 
7
7
  let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPress(_:)))
8
8
 
9
- longPressGesture.cancelsTouchesInView = true
9
+ longPressGesture.cancelsTouchesInView = true
10
10
 
11
- longPressGesture.delegate = self // UIGestureRecognizerDelegateをセット
11
+ longPressGesture.minimumPressDuration = 0.5
12
12
 
13
+ longPressGesture.delegate = self // UIGestureRecognizerDelegateをセット
14
+
13
- view.addGestureRecognizer(longPressGesture) // Viewに追加.
15
+ view.addGestureRecognizer(longPressGesture) // Viewに追加.
14
16
 
15
17
  ```
16
18