支持平台:iOS
运行环境:iOS
开发语言:Object-c
开发工具:Xcode
源码大小:60.27KB
源码下载地址:http://down.51cto.com/data/1975620
源码简介
第三方库TFStackingSectionsTableView可以把单元格按组堆叠。组头显示在表格上,点击组头可以展开对应的单元格。
源码运行截图
效果图
源码片段
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- self.groups = @[@"Group A", @"Group B", @"Group C", @"Group D", @"Group E", @"Group F", @"Group G", @"Group H"];
- self.members = @[
- @[@"Brazil", @"Mexico", @"Croatia", @"Cameroon"],
- @[@"Netherlands", @"Chile", @"Spain", @"Australia"],
- @[@"Columbia", @"Greece", @"Côte D'Ivoire", @"Japan"],
- @[@"Costa Rica", @"Uraguay", @"Italy", @"England"],
- @[@"France", @"Switzerland", @"Ecuador", @"Honduras"],
- @[@"Argentina", @"Nigeria", @"Bosnia and Herzegovina", @"Iran"],
- @[@"Germany", @"USA", @"Portugal", @"Ghana"],
- @[@"Belgium", @"Algeria", @"Russia", @"Korea Republic"]
- ];
- }
- - (UIView *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
- return self.groups[section];
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- return nil;
- UILabel *label = [UILabel new];
- label.text = [@" " stringByAppendingString:self.groups[section]];
- label.backgroundColor = [UIColor colorWithWhite:0.97f alpha:1.0];
- label.textColor = [UIColor colorWithWhite:0.13f alpha:1.0];
- label.font = [UIFont boldSystemFontOfSize:14.0f];
- return label;
- }