将背景设置为GroupTableViewBackgroundColor

hyd*_*dev 2 uitableview xamarin.ios

我的Monotouch iPhone应用程序中有一个UIViewController,我想在UITableViewStyle.Grouped中设置背景.但是,当我使用下面的代码时,它返回黑屏.

this.View.BackgroundColor = UIColor.GroupTableViewBackgroundColor;  // Black screen
this.View.BackgroundColor = UIColor.Red; // Works
Run Code Online (Sandbox Code Playgroud)

我在ViewWillAppear方法中调用它们.如果我注释掉GroupTable,那么背景将设置为红色.当我注释掉第二行时,我得到的只是黑屏.

有人知道为什么吗?如果你不在UITableViewController中,你能不能调用UIColor.GroupTableViewBackgroundColor吗?

谢谢

麦克风

P R*_*R J 6

我已经在我当前的项目中使用了它并且它工作正常我有xcode 4.0和模拟器4.3我在网上发现它在ios 6上已被弃用我已经使用过像这样

[self.tableview setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
Run Code Online (Sandbox Code Playgroud)

刚看看这个链接是iOS6上不推荐使用的groupTableViewBackgroundColor吗?

另外,你可以找到与UItableview相同的图像在互联网上的分组样式背景.