Reputation: 9273
i have insert a UIButton in the header of the UITableView in every section, i want know if it's possible when pressed retrieve the section number, i add the button in this way:
- (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;
}
Upvotes: 0
Views: 343
Reputation: 1220
you can use the tag
property of your UIButton.
markAllYes.tag = section
Upvotes: 2