2012-06-11 48 views
1

我試圖通過UIAppearance以同樣的方式我實現了一個自定義的UINavigationBar的(紅寶石運動語法)以cusotmize的UITableViewCell:UITableViewCell的自定義(拉伸)背景使用UIAppearance

bg = UIImage.imageNamed("cell_bg.png").resizableImageWithCapInsets(UIEdgeInsetsMake(0,13,0,13)) 
UITableViewCell.appearance.setBackgroundImage(bg, forState:UIControlStateNormal, barMetrics:UIBarMetricsDefault) 

但了setBackgroundImage沒有定義,也沒有是setBackgroundView也不setBackgroundViewImage ... UITableViewCell符合UIAppearanceContainer,所以我不應該能夠使用其中的一個?

感謝

回答

2

順應UIAppearanceContainer並不意味着你可以設置你喜歡的任何東西的外觀,它只是意味着它會提供一個外觀代理。就我所知,UITableViewCell沒有任何內置的UIAppearance方法。

爲了您的需要,請嘗試使用可伸縮圖像創建UIImageView,並將其設置爲單元格的backgroundView

+0

完全按照我的意思工作。謝謝! – pachun