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)方法處理code
- (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; }