0

I am trying to design a custom UITableViewCell I have done my customizations, but the cell background doesn't seem to want to apply when the actual application is running for example.

The customization of the text and everything applies but the text doesn't want to work. As you can see in the shot below my UITableViewCell has a black background, but in the running app on the left it doesn't.

Any help explaining this would be amazing.

enter image description here

Adam Johnson
  • 2,198
  • 1
  • 17
  • 23
Mahdi Yusuf
  • 19,931
  • 26
  • 72
  • 101
  • Is this your own code? The background color of the cell could be changed in a lot of places if it's another dev's work (check cellForIndexPath:). Also, it looks black, but did you set it yourself? If you set "Default" sometimes it'll look black too. Try setting the background color in cellForIndexPath:? – yuf Dec 12 '12 at 02:50

1 Answers1

-1

My guess is that you are defining a custom table cell but not setting the height in your tableview datasource functions. heightForCellAtIndex. You need to return the right size on that.

rooster117
  • 5,502
  • 1
  • 21
  • 19
  • I am asking about the background color not the cell size, but that is an issue as well. can you elaborate on your answer? – Mahdi Yusuf Dec 12 '12 at 00:42
  • Yes my answer was related to the size. You should implement the tableview method: - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath { return 80.0f; } // assuming that's the height of your cell – rooster117 Dec 12 '12 at 00:46
  • I'm not sure about the color but it may just be taking the color of the tableview itself so setting that could be a fix to that issue – rooster117 Dec 12 '12 at 00:47
  • I am more concerned with the background color. I have written that code. can you answer the question I am asking :) – Mahdi Yusuf Dec 12 '12 at 00:47