I want a TitleHeaderForSection after case 3 (example) (TableView).
Is Something like this possible:
Case 3:
TitleHeaderForSection = @"menu";
Break;
example:
Case 0
Case 1
Case 2
Case 3
MENU (TitleHeaderForSection)
Case 4
Case 5
i tried:
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
NSString *sectionHeader = nil;
if(section == 0) {
sectionHeader = @"1";
}
if(section == 1) {
sectionHeader = @"2";
}
if(section == 2) {
sectionHeader = @"3";
}
return sectionHeader;
}
but only ‘1’ is showing.
Yes, you can do something like that. Why did you ask the question before trying it out?
If you return a string from
[tableView: titleForHeaderInSection:], it will appear for the section it matches (in your case, 3). Make sure to return nil for the other sections tho. I’ve linked theUITableViewDataSourcedocumentation for you.