2017-10-08 18 views
-2

我想要做一個大的tableView標題,就像iOS 11中的健康應用程序一樣。我添加了一個屏幕截圖,以紅色文本顯示此元素。如何做大頭tableView如何做大型tableView頭?

回答

0

只需設置tableHeaderView的框架屬性即可。

0
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 

UILabel *TESTLabel = [[UILabel alloc] init]; 
TESTLabel .frame = CGRectMake(20, 8, 320, 40); 
TESTLabel .font = [UIFont boldSystemFontOfSize:18]; 
TESTLabel .text = [self tableView:tableView titleForHeaderInSection:section]; 

UIView *headerView = [[UIView alloc] init]; 
[headerView addSubview: TESTLabel]; 

return headerView; 
} 

試試這個