redribben

rowheight

Feb 3rd, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ******How to have a dynamic heightForRow:******
  2.  
  3. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  4.    
  5.     NSString *cellText = [[TableViewData news] valueForKey:[NSString stringWithFormat:@"%d",[indexPath row]]];
  6.     UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:10.0];
  7.     CGSize labelSize = [cellText sizeWithFont:cellFont
  8.                             constrainedToSize:constraintSize
  9.                                 lineBreakMode:UILineBreakModeWordWrap];
  10.     return lableSize ;
  11. }
  12.  
  13.  
  14.  
  15.  
  16.  
  17. *******What I have to work with:********
  18. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  19.     BMOptionCell *cell = objCellClicked;
  20.     if ([indexPath row] == selectedRowNumber) {
  21.         if (!(selectedRowNumber == rowExpanded)) {
  22.             self.rowExpanded = [indexPath row];
  23.             cell.infoLabel.hidden = NO;                                
  24.             return  250;
  25.         }
  26.         if (selectedRowNumber == rowExpanded) {
  27.             cell.infoLabel.hidden = YES;
  28.             self.rowExpanded = -1;
  29.             return 69;
  30.         }
  31.     }
  32.     return 69;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment