I’m trying to render my UILabel in multiple line.
i’ve tried:
CGRect rect2 = CGRectMake(100, 45, 150, 60);
FontLabel *addresLbl1 = [[FontLabel alloc] initWithFrame:rect2
fontName:@"arial" pointSize:12.0f];
//#006000
addresLbl1.textColor = [UIColor colorWithRed:84/255.0 green:84/255.0 blue:84/255.0 alpha:1.0];
addresLbl1.text = @"401 King St\\nToronto, Ontario, M5V1K1\\nCanada";
//[addresLbl1 setTextAlignment:UITextAlignmentCenter];
addresLbl1.backgroundColor = nil;
addresLbl1.opaque = NO;
[cell.contentView addSubview:addresLbl1];
[addresLbl1 release];
but it is rendered as 401 King St\nToronto, Ontario, M5V1K1\nCanada
Note that this label is added on cell of UITableView.
I need new line from the position of ‘\n’ in string and this string will come from server, so position of ‘\n’may vary
You shouldn’t use doubble backslashes.
So you’re code should be like this: