iosobjective-cresponsivetextlabel

Set height of label


To make my app more responsive I want to set the height of my label to expand it over the full cell.

It's now this: https://blazor.nl/uploads/get/cd6a93c852623266882afce5b480b804/IMG-0296

How can I do this?

My label is cell.textLabel.text = [NSString stringWithFormat:@"%@", [self.alerts objectAtIndex:indexPath.row]];

Thanks


Solution

  • You need to set the number of rows 0.

    cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
    cell.textLabel.numberOfLines = 0;