2011-09-21 105 views
2

你可以做什麼不同的事情來編輯一個tableview的外觀,你會怎麼做?例如,你將如何以編程方式更改顏色?或以編程方式更改導航欄的顏色?如何更改UITableView的外觀?

+5

太寬泛的一個問題。有什麼具體的你想完成? –

回答

3

查看關於UITableViewUITableViewCell的文檔。

您probaby想要更改backgroundColor屬性或自定義每個單元格的contentView屬性。此外,查看圖層,您可以在視圖圖層上執行諸如製作圓角,陰影等的操作。

這裏是QuartzCore Framework docs。如果您嘗試更改視圖的外觀,它們應該很有用。


編輯(很好的建議bshirley):

AboutTableViewsiPhone

+1

特別是[適用於iOS的Table View Programming Guide](http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/AboutTableViewsiPhone/AboutTableViewsiPhone.html) – bshirley

1

退房蘋果的UITableView的doc特別的配置表格視圖部分。

1
[tableView setBackgroundColor:[UIColor grayColor]]; 

或者您可以使用,

[tableView setBackgroundColor:[colorWithRed:.98 green:.98 blue:.82 alpha:1]]; 
1

如果要更改應用中的所有TableViews的外觀,你可以與外觀屬性來定義它。在Monotouch中你可以這樣做:

UITableView.Appearance.BackgroundColor = UIColor.Black; 
UITableViewCell.Appearance.BackgroundColor = UIColor.Black; 

在目標C中,它會是類似的東西。