tableView:viewForHeaderInSection:
是调整 UITableViewCell 标题部分字体颜色的最佳方式吗?
我想简单地调整字体颜色(理想情况下),而不必定义 UIView
。我特别不愿意使用上述方法,因为过去对齐节标题给我带来了麻烦。
最佳答案
tableView:viewForHeaderInSection:返回一个 UIView。您必须创建一个 UIView,将 UILabel 添加到 UIView 中,并调整 UILabel 的字体。
例如:
{
UIView *headerView = [[[UIView alloc]
initWithFrame:CGRectMake(0,0,self.view.frame.size.width, 30)] autorelease];
UILabel *label = [[UILabel alloc] initWithFrame:headerView.frame];
label.font = [UIFont systemOfFontWithSize:12];
....
return headerView;
}
关于ios - 如何在 UITableView 的部分标题中设置字体颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8483001/