将背景设置为GroupTableViewBackgroundColor

时间:2012-10-02 07:16:31

标签: xamarin.ios uitableview

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

this.View.BackgroundColor = UIColor.GroupTableViewBackgroundColor;  // Black screen
this.View.BackgroundColor = UIColor.Red; // Works

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

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

由于

麦克

1 个答案:

答案 0 :(得分:6)

我在我目前的项目&它工作正常我有xcode 4.0&模拟器4.3 我在网上发现它在ios 6上被弃用了 我用过这样的

[self.tableview setBackgroundColor:[UIColor groupTableViewBackgroundColor]];

只需查看此链接is groupTableViewBackgroundColor deprecated on iOS 6?

即可

替代方案,您可以在互联网上找到与UItableview分组样式背景相同的图像。

相关问题