gpt4 book ai didi

ios - 如何更改 GetCell() 中的单元格颜色?

转载 作者:行者123 更新时间:2023-11-28 23:29:23 26 4
gpt4 key购买 nike

我正在使用 Xamarin.SideMenu NuGet 包。 https://github.com/TheEightBot/Xamarin.SideMenu

一切正常,除了我需要进行一些自定义。主要是我需要更改弹出抽屉菜单选项的字体颜色。

我尝试设置 cell.TintColor = UIColor.Red;,但没有任何作用。

这是我的代码:

   public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell(“VibrantCell”);
cell.TextLabel.Text = “Index ” + indexPath.Row;
cell.TintColor = UIColor.Blue;
cell.BackgroundColor = UIColor.Green;
return cell;
}

[Export(“tableView:willDisplayCell:forRowAtIndexPath:“)]
public override void WillDisplay(UITableView tableView, UITableViewCell cell, Foundation.NSIndexPath indexPath)
{
cell.TintColor = UIColor.Red; // no effect?
cell.BackgroundColor = UIColor.Green; // no effect?
}

由于某种原因,颜色没有改变,仍然是黑色。

有没有办法在 native Xamarin.iOS 上获得弹出抽屉,其中文本颜色不是黑色?

非常感谢。

最佳答案

您不应该修改单元格本身。您应该修改单元格的 TextLabel 属性。

所以应该是:

cell.TextLabel.TextColor = UIColor.Red;

关于ios - 如何更改 GetCell() 中的单元格颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57334267/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com