簡體   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