2012-10-02 79 views
2

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

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

我在ViewWillAppear方法中调用这些方法。如果我注释掉GroupTable,那么后台会被设置为Red。当我将第二行注释掉时,我所得到的只是一个黑屏。

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

感谢

迈克

回答

6

我已经使用这个对我目前的项目&它工作得很好,我有Xcode的4.0 &模拟器4.3 我已经在网上发现它在iOS弃用6 我已经使用这样

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

只是看看这个链接is groupTableViewBackgroundColor deprecated on iOS 6?

为替代你可以找到相同的图像作为UItableview在互联网上分组的样式背景。

+0

谢谢 - 我在iOS6中开发,所以我的问题是它已被弃用。 – hydev