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?
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
add this code in your cellForRowAtIndexPath
if (indexPath.section == self.expandedSection || indexPath.row <= 3) {
Cell.hidden = NO;
}
else{
Cell.hidden = YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With