蘋果公司的代碼注釋上寫的:should be added to the content view
// Custom subviews should be added to the content view.
@property (nonatomic, readonly, strong) UIView *contentView;
所以之前我們可以直接將視圖添加在cell上:
[self addSubview:self.titleLabel];
而不是:
[self.contentView addSubview:self.titleLabel];
以后如果視圖直接添加在cell上將會導(dǎo)致添加的視圖手勢,點擊事件無法生效,親測有效。
http://www.itdecent.cn/p/4b6bf3e37edc
iOS 14 UITableViewCell 長按手勢 UILongPressGestureRecognizer 不生效的問題最近碰到一個添加到 cell 的長按手勢不生效,diff 了一下,發(fā)現(xiàn) 在 iOS 14 UITableViewCellContentView 相比 iOS 13 多了一個手...