retrieve section from UIButton in Header view in section in UITableview

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;


you can use the tag property of your UIButton.

markAllYes.tag = section

Need Your Help

Set active tab style with AngularJS

javascript html angularjs

I have routes set in AngularJS like this:

Refactoring Code to avoid Type Casting

c# generics design-patterns domain-driven-design visitor

I have following C# code in .Net 4.0. It requires a type casting of IBusiness to IRetailBusiness.