在項(xiàng)目使用當(dāng)中發(fā)現(xiàn),當(dāng)在外面的view添加了pan手勢(shì)后。會(huì)導(dǎo)致在編輯UITableViewController的Cell時(shí)——拖動(dòng)cell調(diào)整位置時(shí),會(huì)有手勢(shì)沖突的問(wèn)題绿聘。拖動(dòng)cell的手勢(shì)會(huì)失敗。如下圖所示:
本來(lái)嘗試在
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
方法當(dāng)中來(lái)處理次舌,發(fā)現(xiàn)沒(méi)有效果熄攘,tableview的手勢(shì)直接失敗了,還是無(wú)法調(diào)整垃它。最后沒(méi)有辦法鲜屏,只能增加一個(gè)標(biāo)識(shí)位,當(dāng)有tableView時(shí)国拇,讓pan手勢(shì)忽略觸摸事件洛史。
處理方法在//- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
當(dāng)中。
下面的測(cè)試demo:https://github.com/tornador92/PanGestureConflict酱吝。
如果有大神有其它方法可以比較好的處理這種事情也殖,請(qǐng)?jiān)谙旅媪粞裕嘀x务热!