I have made a custom section-header for UITableView, that includes some controls like segmented control, UIImageView ,etc. It successfully appears, but it\'s not tappable so
Here is what worked for me
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
static NSString *cellIdentifier = @"cellIdentifier";
YourHeaderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
cell.imageView.image = [image imageNamed:@"imageName"];
cell.segmentedControl.tag = section;
[cell.segmentedControl addTarget:self
action:@selector(action:)
forControlEvents:UIControlEventValueChanged];
return cell;
}
- (void)action:(id)sender{
UISegmentedControl *segmentedControl = (UISegmentedControl *) sender;
NSLog(@"selected section:%ld",(long)segmentedControl.tag);
}