![](/img/trans.png)
[英]Touch events in a subview of a UITableViewCell of a static UITableView
[英]UITableView inside UITableViewCell not receiving touch events
所以我有一個嵌套在UITableViewCell中的UITableView,例如:
UITableView baseTable
UITableViewCell baseTableCell0
UITableViewCell baseTableCell1
subView連接了一個UITapGestureRecognizer,就像按鈕一樣,subTableView和subCollectionView應該接收觸摸事件並執行didSelectRowAtIndexPath
在iOS 8上,它工作正常,但是當我在ios 7上進行測試時,subTableView和subCollectionView中的單元格不再接收觸摸事件,觸摸事件將發送到[baseTableView tableview ... didSelectRowAtIndexPath]。 但是,subView上的UITapGestureRecognizer仍可以接收觸摸事件。
在標簽手勢對象上使用此代碼
tap.cancelsTouchesInView = NO;
嘗試更改UITableView,UITableViewCell和UIView的背景顏色,這樣您就可以查看子視圖是否未超出父視圖,如果子視圖不會接收觸摸事件。 然后,調整“父級”以完全顯示子級,或者調整子級以保留在父級邊界中。
希望能幫助到你!
編輯:
將觸摸事件傳遞給子視圖可能會有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.