我想獲取索引時點擊UITableView
標題。現在,我沒有添加UIGestureRecognizer
到標題那樣:通過索引攻絲UITableViewHeader
- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sectionTapped:)];
UIView *headerView = [UIView new];
headerView.backgroundColor = [UIColor grayColor];
[headerView addGestureRecognizer:recognizer];
// return [self.myTableView headerWithTitle:self.headers[section] totalRows:self.cells.count inSection:section];
return headerView;
}
-(IBAction)sectionTapped:(id)sender{
NSLog(@"tapped header");
}
是否有簡便的方式來傳遞部分Index
上自來水?
是你的隔宿ture is works –