UITableView *tableView = [[UITableView alloc] init];
tableView.delaysContentTouches = NO;
for (id view in tableView.subviews) {
if ([view respondsToSelector:@selector(setDelaysContentTouches:)]){
[view setDelaysContentTouches:NO];
}
}
如果cell里面有UIScrollView控件
在initWithStyle:reuseIdentifier:
或 initWithCoder:
(xib)方法处理
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
for (id view in self.subviews) {
if ([view respondsToSelector:@selector(setDelaysContentTouches:)]){
[view setDelaysContentTouches:NO];
}
}
}
return self;
}
网友评论