Let see that I have a string look like this:
NSString *longStr = @\"AAAAA\\nBBBBB\\nCCCCC\";
How do I make it so that the UILabel disp
In Swift 2.2, > iOS 8
I've set Lines = 0 on Storyboard, under Attribute Inspector and linked a referencing outlet to the label. Then use in controller like this:
@IBOutlet weak var listLabel: UILabel!
override func viewDidLoad() {
...
listLabel.text = "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8"
}
Just using label.numberOfLines = 0;
Just do it like this
NSString * strCheck = @"A\nB";
strCheck = [strCheck stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"]; //This is to prevent for fetching string from plist or data structure
label.numberOfLines = 0;
label.lineBreakMode = NSLineBreakByWordWrapping;
label.text = strCheck;