are you setting the text like: cell.textLabel.text = myText
?
I that case you are sending it to an UILabel, and UILabels can't have linebreaks.
What you can try is to create a custom cell with an UITextView and send your text there.
Example of a custom cell:
The tableview class:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"quickListViewCell";
quickListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"quickListViewCell" owner:nil options:nil];
for(id currentObject in topLevelObjects)
{
if([currentObject isKindOfClass:[quickListViewCell class]])
{
cell = (quickListViewCell *)currentObject;
break;
}
}
}
[[cell textFieldText] setText:@"Line 1 \n Line 2"];
return cell;
}
quickListViewCell.h
#import <UIKit/UIKit.h>
@interface appCountryCategoryViewCell : UITableViewCell {
IBOutlet UITextView *textFieldText;
}
@property (nonatomic, retain) IBOutlet UITextView *textFieldText;
@end
quickListViewCell.m
#import "quickListViewCell.h"
@implementation quickListViewCell
@synthesize textFieldText;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)dealloc {
[super dealloc];
}
@end
Create a UITableViewCell in IB and set the identifier to "quickListViewCell".
Hope my answer helped you.
Best regards,
Paul Peelen