问题描述
|
如何在iPhone的Tableview中更改每一行文本的颜色?有人知道吗?然后请给我指导。
提前致谢。
解决方法
基本上,您需要在
tableView:CellForRowAtIndexPath:
方法中执行以下操作
cell.textLabel.textColor = yourColor;
如果您想了解有关使用自定义单元格的更多信息,可以查看我的博客有效移动性
, 在
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
加:
cell.textLabel.textColor = [UIColor redColor];
, 将所有行颜色放入NSArray中。假设myColorArray它将包含所有您的行的UIColor对象。
然后在里面做do4ѭ
tableView:CellForRowAtIndexPath:
功能。