redribben icon

rowheight

redribben | PRO | 02/03/15 05:27:29 AM UTC | 0 ⭐ | 438 👁️ | Never ⏰ | []
Objective C |

0 B

|

None

|

0 👍

/

0 👎

******How to have a dynamic heightForRow:******
 
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString *cellText = [[TableViewData news] valueForKey:[NSString stringWithFormat:@"%d",[indexPath row]]];
    UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:10.0];
    CGSize labelSize = [cellText sizeWithFont:cellFont
                            constrainedToSize:constraintSize
                                lineBreakMode:UILineBreakModeWordWrap];
    return lableSize ;
}
 
 
 
 
 
*******What I have to work with:********
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    BMOptionCell *cell = objCellClicked;
    if ([indexPath row] == selectedRowNumber) {
        if (!(selectedRowNumber == rowExpanded)) {
            self.rowExpanded = [indexPath row];
            cell.infoLabel.hidden = NO;                                
            return  250;
        }
        if (selectedRowNumber == rowExpanded) {
            cell.infoLabel.hidden = YES;
            self.rowExpanded = -1;
            return 69;
        }
    }
    return 69;
}

Comments