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


source to share


4 answers


Try the following:

label.text = [label.text stringByAppendingString:@"your text"];

      



This will help you.

+13


source


label.text = [NSString stringWithFormat:@"%@%@", label.text, @"your text to append"];

      



+3


source


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


source


I am using as lines below,

label.text = "My Text"
label.text = label.text! + " appended text"

      

+1


source







All Articles