Reputation: 2277
Having myArray (NSMutableArray
) as dataSource
with events
And the custom table sections are:
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
customSections = [[NSMutableArray alloc] init];
//My custom sections
[customSections addObject:@"now"];
[customSections addObject:@"in this day"];
NSString *sectionText = [customSections objectAtIndex:section];
return sectionText;
}
What's the best practice to short them? for each event I have a start time and end time
Upvotes: 0
Views: 570
Reputation: 3980
You should initialize and fill in your customSections array somewhere in another place (for example when you initializing this class). Than you have to do something like this:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [customSections count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return [customSections objectAtIndex:section];
}
Upvotes: 1