我在每个部分的 UITableView 的标题中插入了一个 UIButton,我想知道按下时是否可以检索部分编号,我以这种方式添加按钮:
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 309, 70)];
UIButton *markAllYes = [UIButton buttonWithType:UIButtonTypeCustom];
[markAllYes setImage:[UIImage imageNamed:@"mini_seen.png"] forState:UIControlStateNormal];
[markAllYes setFrame:CGRectMake(95, 35, 31, 31)];
[markAllYes addTarget:self action:@selector(markAllYesPressed:) forControlEvents:UIControlEventTouchUpInside];
[headerView addSubview:markAllYes];
return headerView;
}