Note that there are some explanatory texts on larger screens.

plurals
  1. POFailed to increase the height of a UILabel for Multi-line UITable
    primarykey
    data
    text
    <p>I am trying to resize the height of UILabel in a Table Cell. INnmy case the table is dynamic and I have customized it using two UILabel. The Table will show exactly 11 items, but two of the cells will need to accommodate multi-line text UILabel. I have selectively increase the height of two cells as follows:</p> <pre><code>-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath.row == 3 || indexPath.row == 10) return 100; else return 46; } </code></pre> <p>But I also need to increase the height of the UILabel for those two cells only. I have tried using following code (also tried some other examples from this site). </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CellId"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // Configure the cell... UILabel *DetailLabel = (UILabel *)[cell.contentView viewWithTag:10]; UILabel *DetailText = (UILabel *)[cell.contentView viewWithTag:20]; if(indexPath.row == 3 || indexPath.row ==10){ [DetailText setText:[self.EmployerViewText objectAtIndex:[indexPath row]]]; DetailText.lineBreakMode = NSLineBreakByWordWrapping; DetailText.font = [UIFont systemFontOfSize:17.0f]; DetailText.numberOfLines = 0; DetailText.frame = CGRectMake(0, 0, 317, 80); [DetailText sizeToFit]; }else{ [DetailText setText:[self.EmployerViewText objectAtIndex:[indexPath row]]]; } [DetailLabel setText:[self.EmployerViewLabel objectAtIndex:[indexPath row]]]; return cell; } </code></pre> <p>Unfortunately, the size of the UILable remained unchanged. Can anyone point out what I am doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload