回答編集履歴
2
訂正
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
isEnabled == true でも falseでも親viewのtouchesBeganイベントをキャンセルするので、
|
1
|
+
isEnabled == true でも falseでも子View(領域内)のタップ時は親viewのtouchesBeganイベントをキャンセルするので、
|
2
2
|
親view(blueView)内で子view(greenBtn)領域内のイベントを全てキャンセルして解決。
|
3
3
|
|
4
4
|
|
1
追記
answer
CHANGED
@@ -41,4 +41,17 @@
|
|
41
41
|
class GreenBtn: UIButton {
|
42
42
|
|
43
43
|
}
|
44
|
+
```
|
45
|
+
|
46
|
+
実際はUITableViewCell上のボタンなので以下で対応
|
47
|
+
|
48
|
+
```swift
|
49
|
+
class HogeCell: UITableViewCell {
|
50
|
+
|
51
|
+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
52
|
+
let point = touches.first!.location(in: self.contentView)
|
53
|
+
if hogeBtn.frame.contains(point) { return }
|
54
|
+
super.touchesBegan(touches, with: event) // -> ViewControllerのshouldHighlightRowAtへ処理がつながる
|
55
|
+
}
|
56
|
+
}
|
44
57
|
```
|