Это старый вопрос, но есть более лучший ответ на этот вопрос:
Смотрите этот ответ: https://stackoverflow.com/a/19173639/2371425
tl; dr - iOS6 предоставил нам эти новые методы для изменения атрибутов верхних / нижних колонтитулов раздела.
-(void)tableView:(UITableView *)tableView
willDisplayHeaderView:(UIView *)view
forSection:(NSInteger)
- (void)tableView:(UITableView *)tableView
willDisplayFooterView:(UIView *)view
forSection:(NSInteger)section
Используйте эти методы для добавления UITapGestureRecognizer
в headerView.
Ex.
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sectionTapped:)];
[view addGestureRecognizer:recognizer];
}
- (IBAction)sectionTapped:(UITapGestureRecognizer *)recognizer {
NSLog(@"Tapped");
}