IOS开发基础之汽车品牌项目-14
//
// ViewController.m
// 16-汽车品牌展示02
//
// Created by 鲁军 on 2021/2/3.
//
#import "ViewController.h"
#import "CZGroup.h"
#import "CZCar.h"
@interface ViewController () <UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)NSArray *groups;
@end
@implementation ViewController
- (NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView{
//
// NSMutableArray *arrayIndex = [NSMutableArray array];
// for(CZGroup *group in self.groups){
// [arrayIndex addObject:group.title];
// }
// return arrayIndex;
// return @[@"A",@"B",@"C",@"D"];
return [self.groups valueForKey:@"title"];
}
#pragma 数据源方法
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
CZGroup *group = self.groups[section];
return group.title;
}
- (UITableViewCell *)tableView:(UITableView *