最近碰到一個添加到 cell 的長按手勢不生效,diff 了一下,發(fā)現(xiàn) 在 iOS 14 UITableViewCellContentView 相比 iOS 13 多了一個手勢(回調(diào)是一樣的),不知道是不是系統(tǒng) bug。
iOS 14

image.png
iOS 13

image.png
通過嘗試要讓我們自定義的手勢生效,需要在 delegate 上寫上:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
猜測是因為 iOS 14 多加的那個手勢沖突導(dǎo)致了無法同時響應(yīng)多個手勢。
(估計微信聊天界面氣泡長按無響應(yīng)也是這個問題)