I created custom UITableViewCell.
@interface AnswerCell : UITableViewCell
@property (nonatomic, retain) IBOutlet UILabel *textLabel;
@property (nonatomic, retain) IBOutlet UILabel *detailTextLabel;
@end
and set detailTextLabel.numberOfLines = 0;
cell = [tableView dequeueReusableCellWithIdentifier:kAnswerIdentifier];
if (cell == nil)
{
[[NSBundle mainBundle] loadNibNamed:@"AnswerCell" owner:self options:nil];
cell=answerCell;
}
cell.detailTextLabel.text = [self extractText:indexPath forLabelAttribute:kDetailTextLabel];
cell.detailTextLabel.font = [self extractFont:indexPath forLabelAttribute:kDetailTextLabel];
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.detailTextLabel.numberOfLines = 0;
UILabel shows only first line of the text. But why?
UPDATE: My detailTextLabel’s height = 21. What do I need to do? Do I need to change height = 1000?
I guess you cannot show all text because label height is too small. You need to set required height depending on the text length.
See answer for Adjust UILabel height depending on the text