Setting row height to 0 in UITableView, but cell text still shows up overlapping

ios, objective-c, uitableview

Solution

Should add as answer:

be sure to have Clip to bounds property set to YES either on nib file or programmatically as `cell.clipToBounds=YES`

Problem

I currently have my row heights set up like so: ``` - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == self.expandedSection || indexPath.row <= 3) { return 65; } return 0; } ``` I essentially only want the first 4 rows to be visible by default, unless the section is in expanded form, in which case all rows are visible. I'm doing this by setting the row heights of the first 4 to 65, and the rest to 0. The rows and their respective images don't show up, however the `cell.textLabel` and `cell.detailTextLabel`s are, leading to them looking like the picture below. How can I disable both of those so that they don't show up at all for any rows past row 4?

Original source