iPhone cocoa : UITableViewCell background not displaying the color set into IB
I made a custom cell for a UITableView (subclassing UITableView开发者_如何学GoCel, e..., and with a xib). In IB, i set the background color of the myUITableViewCell to a light grey. Simulated into IB (with a run), the cell looks great (a full grey even under the disclosure button). But when I run the application, the cell keeps showing a white background. Do you know why this happens ?
May I have to do this programmaticaly to make it work ?
Do you init the cell with initWithNibName:@"YOURXIBFILE" ...? Did you overwrite the drawRect Method?
yea, there is some problems to create custem cell with IB.
try write it in code, you can see a tutorial how to do this:
http://blog.webscale.co.in/?p=284
I found a great help at : Setting background color of a table view cell on iPhone
In fact it seems that this behaviour needs coding... a very few lines, as the color set in IB is cleared at draw time. So the background color have to be set in the "willDisplayCell" tableview delegate method.
精彩评论