Search code examples
ios5xcode4uitableviewuikituistoryboard

Why Isn't A Table View Detecting The Right Height For A Cell?


Basically, I have a UITabBar that contains a UITableView in each tab. The tables are different, but they have the same custom UITableViewCells, except that the second table view has a label in bold font.

Here's an screenshot to explain this better:

Screenshot

You can clearly cell the UITabBar, and the UITableViews it contains. You can observe that the cells are almost the same except for the bolded font. I created the second UITableViewCell by option-dragging the first one and changing the font of the first label. It's literally an exact copy of the other cell, with a different label and a different identifier.

But when I run my app, I see two different things. Only the cells from the first table view look fine. The ones from the second look like normal cells without any custom views inside.

Here is a screenshot of the first table view that looks fine:

Correct Table View Cell

But the second that should show exactly the same cells with the same sizes does not.

Incorrect Table View Cell

So what gives? What's going on? This makes no sense. The TableViewCells are exactly the same with the few variations I mentioned above. Yes, they also have different view controllers, but I haven't touched any of the view controllers for the first cell to look fine.

Could it be an XCode bug? Honestly I find XCode to be very buggy, so I wouldn't be surprised if for some reason it was completely ignoring my second cell.

Any help will be really appreciated.


Solution

  • The problem was my own stupidity. I was modifying the wrong screen all that time. Late answer, solved it years ago, but I think this should help those check "the little things", always.