繁体   English   中英

如何在iPhone应用程序中将表格视图中显示的文本的颜色从默认的黑色更改为?

[英]How to Change the color of the text present in table view from its default black color in an iphone application?

如何在iPhone应用程序中将表视图中显示的文本的颜色从默认的黑色更改为?

尝试这个。

cell.textLabel.textColor=[UIColor blueColor];

您也可以给RGB值,例如

cell.textLabel.textColor =  [UIColor colorWithRed:200/256.0 green:0/256.0 blue:67/256.0 alpha:1.0];

祝一切顺利。

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

 static NSString *CellIdentifier = @"Cell";

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
 if (cell == nil) 
 {
 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
 cell.textLabel.textColor = [UIColor yellowColor]; //Change the text color

 }

 // Configure the cell...

 return cell;
 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM