I have a tableview
but none of the cells are displaying longer text. What's even stranger is it doesn't seem to be a set value that they stop at. Some cells display more text than others before they are cut off. NSLog()
confirms the string is correctly set.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//code for getting string removed for readability
// Identifier for retrieving reusable cells.
static NSString *cellIdentifier = @"MyCellIdentifier";
// Attempt to request the reusable cell.
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
// No cell available - create one.
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
// format it
cell.textLabel.numberOfLines = 0;
cell.textLabel.font = [UIFont systemFontOfSize:12.0];
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
}
// Set the text of the cell to the row index.
cell.textLabel.text = fulltext;
return cell;
}
I was under the impression the numberOfLines
function at 0
would handle it but all of the cells are at 2 lines, no more. How can I make them adjust to as many lines as needed? Thanks.