#import "ViewController.h" @interface ViewController ()<UITableViewDelegate,UITableViewDataSource> @property (nonatomic,strong) UITableView *tableView; @property (nonatomic,strong) NSArray *dataSource; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; Self. title = @" view font set "; [self.view addSubview:self.tableView]; } #pragma mark - lazy - (UITableView *)tableView { if (! _tableView) { _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; _tableView.delegate = self; _tableView.dataSource = self; _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; } #pragma mark - lazyLoding - (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]; return cell; } @endCopy the code