I have a tableview code like this:
my tableview.m file:
@implementation RevealTableViewController {
NSArray *menuItems;
}
- (void)viewDidLoad {
[super viewDidLoad];
menuItems = @[@"CART", @"WISHLIST", @"LOGIN", @"REGISTER", @"NEW ARRIVALS", @"BRANDS", @"CLOTHING", @"ACCESSORIES", @"SHOES",@"CATEGORY 6", @"CATEGORY 7",@"CATEGORY 8",@"CATEGORY 9"];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return menuItems.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [menuItems objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
return cell;
}
I know how to make a section header by titleForHeaderInSection method in first line, but if I just want to grouping my tableview form @"NEW ARRIVALS" to @"CATEGORY 9"? How can I do?