UITableViewStylePlain实现分组效果
1.初始化UITableView UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain]; tableView.delegate = self; tableView.dataSource = self; tableView.sectionHeaderHeight = 10; tableView.sectionFooterHeight = 10; [self.view addSubview:tableView]; 2.实现数据源UITableViewDataSource中的两个方法 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { return @"sectionHeader"; } - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { return @"sectionFooter"; }