Для добавления кнопки в заголовок таблицы вам необходимо использовать методы делегаты класса
UITableView
Метод, в котором указываем высоту View, которую мы будем вставлять в заголовок
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
Метод, в котором определяем View и содержащуюся в ней кнопку
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
Пример добавления кнопки в заголовок таблицы
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 58;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *customView = [[[UIView alloc]
initWithFrame:CGRectMake(10.0, 0.0, self.view.bounds.size.width, 53.0)]
autorelease];
CustomGradientButon *changeConditionsButton =
[[CustomGradientButon alloc]
initWithFrame:CGRectMake(
(self.view.bounds.size.width - 250)/2, 15.0, 250.0, 38.0)];
[changeConditionsButton setButtonTitleLabel:@"Изменить условия поиска"];
[changeConditionsButton addTarget:self
action:@selector(changeConditionsButtonClicked)
forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:changeConditionsButton];
return customView;
}
-(void) changeConditionsButtonClicked {
if (!fromFilter) {
[self performSegueWithIdentifier:@"ChangeConditions" sender:self];
} else {
[self.navigationController popViewControllerAnimated:YES];
}
}