简体   繁体   中英

iPhone cocoa : UITableViewCell background not displaying the color set into IB

I made a custom cell for a UITableView (subclassing UITableViewCel, 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM