How can we make the text in the label of a table view go to the next line?
The label must also be configured to allow multiple lines.
Marc W
2009-11-18 07:15:30
A:
you can try to use cell with subtitle( initWithStyle:UITableViewCellStyleSubtitle ). if it is not exactly what you want, you can customize your cell by adding UITextView(or, maybe, several UILabels) to it as a subView(s).
Morion
2009-11-18 07:19:17
+3
A:
//This allows for multiple lines
cell.textLabel.numberOfLines = 0;
//This makes your label wrap words as they reach the end of a line
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
Also, if you want your label to have more room for such multiple lines, you probably should allow for table rows with greater height. You can do this either by overriding
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
and returning your custom height for each row there, or by specifying your table's rowHeight
property, giving the common height of each row.
luvieere
2009-11-18 07:44:42