How to add more text to UILabel in iOS?
I want to add more text behind UILabel in iOS.
In other languages, we can add the following like:
String s += textBox.text;
We can use the sign (+ =) in other languages.
In Objective-C, I don't know how to add to the label.
Please help me.
+3
Fire fist
source
to share
4 answers
Try the following:
label.text = [label.text stringByAppendingString:@"your text"];
This will help you.
+13
tux91
source
to share
label.text = [NSString stringWithFormat:@"%@%@", label.text, @"your text to append"];
+3
Vlad
source
to share
when you have a string that will constantly change, I advise you to use NSMutableString
NSMutableString *str=[[NSMutableString alloc]initWithString:@"aaaaaa"];
[str appendString:@"bbbbbb"];
+3
touti
source
to share
I am using as lines below,
label.text = "My Text"
label.text = label.text! + " appended text"
+1
Thirumalvalavan
source
to share