C# 如何在GroupedStyle中更改UITableViewController的背景
我试图在使用拆分视图时更改C# 如何在GroupedStyle中更改UITableViewController的背景,c#,colors,xamarin.ios,uitableview,C#,Colors,Xamarin.ios,Uitableview,我试图在使用拆分视图时更改UITableViewController的颜色。然后将样式设置为“分组”,无论发生什么情况,背景看起来都是浅灰色 我创建了一个新的iPad Split应用程序解决方案,并将以下代码添加到RootViewController: public RootViewController () : base( UITableViewStyle.Grouped) // base ("RootViewController", null) {
UITableViewController
的颜色。然后将样式设置为“分组”,无论发生什么情况,背景看起来都是浅灰色
我创建了一个新的iPad Split应用程序解决方案,并将以下代码添加到RootViewController
:
public RootViewController () : base( UITableViewStyle.Grouped) // base ("RootViewController", null)
{
this.TableView.BackgroundColor = UIColor.Red;
this.View.BackgroundColor = UIColor.Red;
this.View.Layer.BorderColor = UIColor.Green.CGColor;
this.TableView.BackgroundView.BackgroundColor = UIColor.Brown;
我正在努力弄清楚为什么它总是浅灰色。您不会更改控制器的颜色,而是更改其一个(或多个)视图的颜色 此外,通常必须使用
TintColor
(而不是BackgroundColor
)。有点让人困惑(我认为这与在背景上使用渐变有关,在很多地方都使用渐变,但我可能错了)