如何在 xamarin ios 中自定义 UITableViewCell 的背景颜色?

Posted

技术标签:

【中文标题】如何在 xamarin ios 中自定义 UITableViewCell 的背景颜色?【英文标题】:How to customize the background color of a UITableViewCell in xamarin ios? 【发布时间】:2017-07-06 23:05:11 【问题描述】:

我想自定义 UITableView 中所有 UITableViewCells 的背景。到目前为止,我还无法自定义它们。

看这里:TableView

【问题讨论】:

【参考方案1】:

在您的 GetCell 方法中,只需执行以下操作:

        public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
            
              //Do cell stuff here
            MyTestCell myCell = tableView.DequeueReusableCell("MyTestCell") as MyTestCell;
              .......
              .........
              myCell.BackgroundColor = UIColor.Blue;
            

这样,您所有的 UITableView 单元格都将具有您设置的颜色!

【讨论】:

以上是关于如何在 xamarin ios 中自定义 UITableViewCell 的背景颜色?的主要内容,如果未能解决你的问题,请参考以下文章