Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UItableViewCell setTextColor已弃用_Ios_Objective C_Uitableview - Fatal编程技术网

Ios UItableViewCell setTextColor已弃用

Ios UItableViewCell setTextColor已弃用,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我正在尝试更改UITableViewCell中的文本颜色,将appearancewhencontainedInstancesofclasses用作我应用程序中的主题 以下是代码行: [[UITableViewCell appearanceWhenContainedInInstancesOfClasses:@[[SearchTableView class]]] setTextColor:snackOrangeColor]; 这很有效。但setTextColor在iOS 3.0中被弃用。因此,我不

我正在尝试更改
UITableViewCell
中的文本颜色,将
appearancewhencontainedInstancesofclasses
用作我应用程序中的主题

以下是代码行:

[[UITableViewCell appearanceWhenContainedInInstancesOfClasses:@[[SearchTableView class]]] setTextColor:snackOrangeColor];
这很有效。但setTextColor在iOS 3.0中被弃用。因此,我不能使用它。我还没有找到一个合适的解决办法

我的问题是,我应该使用什么来更改UITableViewCell中的文本颜色,而不是setTextColor


谢谢您的帮助。

尝试更改单元格的textLabel的textColor

 cell.textLabel.textColor = [UIColor someColor];

创建自定义UITableViewCell

[[UILabel appearanceWhenContainedIn:[CustomUITableViewCell class], nil] 
 setTextColor:[UIColor someColor]];

我不认为会有别的选择。我建议在常量中创建颜色,然后在代码中调用常量。

尝试更改单元格的textLabel的textColor

 cell.textLabel.textColor = [UIColor someColor];

创建自定义UITableViewCell

[[UILabel appearanceWhenContainedIn:[CustomUITableViewCell class], nil] 
 setTextColor:[UIColor someColor]];

我不认为会有别的选择。我建议在常量中创建颜色,然后在代码中调用常量。

为单元格创建自定义类,然后拖动并导出UILabel。然后使用该自定义单元格。

为单元格创建自定义类,然后拖动并导出UILabel。然后使用该自定义单元格。

因为添加“textLabel”是正确的


因为添加“textLabel”是正确的


我知道这个方法。但我需要使用UIAppearance,因为我正在为应用程序制作主题。我想这是唯一的方法。谢谢。我知道这个方法。但我需要使用UIAppearance,因为我正在为应用程序制作主题。我想这是唯一的方法。谢谢。谢谢你的回答。@s.d.欢迎你。您可能会发现它很有用-谢谢您的回答。@s.d.欢迎您。你可能会发现它很有用-