自定义UITableViewCell的textLabel字体颜色

我看应用的情况,UITableViewCell的textLabel的textColor是自动控制的,而且好像是根据backgroundColor来判断的。
这个textLabe的textColor能不能像UITableViewCell的backgorundView和selectBackgroundView的方式来设置

阅读 12.3k
1 个回答

cell的textLabel是可以自定义textColor,还有highlightedTextColor,这就是两种状态。

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  if(0 == indexPath.row)
  {
    cell.textLabel.textColor = ...;
    cell.textLabel.highlightedTextColor = ...;
  }
  ...
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题