Xcode write NSLog result in UILabel

2019-09-08 18:53发布

问题:

I use NSLog(@"%@");

And the NSLog result is '23204239423' I don't explain you why ... it's just an example.

I want the NSLog result appear in UILabel, is it possible ?

I tried : Label.text = (@"%@"); , it doesn't work.

Do you know how i can do it ?

Thanks.

回答1:

NSLog usually takes a string like:

NSLog(@"%@", string);

So instead just do this:

label.text = [NSString stringWithFormat:@"%@", string];


回答2:

You have to put a variable

NSString *text = @"My Text";
label.text = text;

Or

label.text = @"Your text";