我正在使用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?
}
由于某种原因,颜色没有变化,仍然是黑色。
有没有办法在本机Xamarin.iOS上获得弹出框,其中文本颜色不是黑色?
非常感谢您。
答案 0 :(得分:1)
您不应该修改单元格本身。您应该修改单元格的TextLabel属性。
应该是:
cell.TextLabel.TextColor = UIColor.Red;