How to append more text into UILabel in iOS?
16,281
Solution 1
Try out this:
label.text = [label.text stringByAppendingString:@"your text"];
This should help you.
Solution 2
label.text = [NSString stringWithFormat:@"%@%@", label.text, @"your text to append"];
Solution 3
when you have a string which will change constantly,i advice you to use NSMutableString
NSMutableString *str=[[NSMutableString alloc]initWithString:@"aaaaaa"];
[str appendString:@"bbbbbb"];
Solution 4
I am used like below lines,
label.text = "My Text"
label.text = label.text! + " appended text"
Author by
Fire Fist
Updated on June 05, 2022Comments
-
Fire Fist almost 2 years
I want to append more text behind UILabel in iOS.
In other languages, we can add following as:
String s += textBox.text;
We can use (+=) sign in others languages.
In Objective-C , I don't know how to add into label.
Please help me.