Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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
Xcode 更改UITableView标题的色调颜色_Xcode_Uitableview_Header_Tint - Fatal编程技术网

Xcode 更改UITableView标题的色调颜色

Xcode 更改UITableView标题的色调颜色,xcode,uitableview,header,tint,Xcode,Uitableview,Header,Tint,为了在tableView中更改节标题的色调,我实现了以下代码。我只是想改变颜色色调,而不是应用我自己的视图。然而,应用程序似乎忽略了它,并且节标题一直以默认的灰色显示。有没有关于我做错了什么的线索?非常感谢 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { [[tableView headerViewForSection:section] setTintCo

为了在tableView中更改节标题的色调,我实现了以下代码。我只是想改变颜色色调,而不是应用我自己的视图。然而,应用程序似乎忽略了它,并且节标题一直以默认的灰色显示。有没有关于我做错了什么的线索?非常感谢

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    [[tableView headerViewForSection:section] setTintColor:[UIColor brownColor]];
    return [tableView headerViewForSection:section];
}

这是100%的工作,您可以更改索引或标题文本颜色

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
    view.tintColor = [UIColor blueColor];

    // if you have index/header text in your tableview change your index text color 
    UITableViewHeaderFooterView *headerIndexText = (UITableViewHeaderFooterView *)view;
    [headerIndexText.textLabel setTextColor:[UIColor blackColor]];

}

请用谷歌搜索。。。当然你会得到“阿尔瓦罗·莫拉莱斯·纳瓦罗”的答案看到这个“阿尔瓦罗·莫拉莱斯·纳瓦罗”谢谢巴布尔,我肯定用谷歌搜索了好几天。解决方案不是使用setTintColor方法,因此它不是我要寻找的。无论如何,谢谢你的帮助。:-)再次感谢!我终于找到了我想要的东西