@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableView
@property (nonatomic,strong) NSArray *dataSource
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad]
// 开启大标题功能
if (@available(iOS 11.0, *)) {
self.navigationController.navigationBar.prefersLargeTitles = YES
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic
}
self.title = @"百度钱包"
[self.view addSubview:self.tableView]
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]
_tableView.delegate = self
_tableView.dataSource = self
_tableView.rowHeight = 80
_tableView.estimatedRowHeight = 0.0
_tableView.sectionHeaderHeight = 0.0
_tableView.sectionFooterHeight = 0.0
_tableView.estimatedSectionHeaderHeight = 0.0
_tableView.estimatedSectionFooterHeight = 0.0
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableView class])]
}
return _tableView
}
- (NSArray *)dataSource {
if (!_dataSource) {
_dataSource = [UIFont familyNames]
}
return _dataSource
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataSource.count
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableView class])]
cell.selectionStyle = UITableViewCellSelectionStyleNone
cell.textLabel.text = self.dataSource[indexPath.row]
cell.textLabel.textColor = [UIColor colorWithRed:49.0/255.0 green:186.0/255.0 blue:81.0/255.0 alpha:1]
cell.textLabel.font = [UIFont fontWithName:@"Futura-Medium" size:17]
return cell
}
@end
