2012-10-02 140 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