Xcode write NSLog result in UILabel

☆樱花仙子☆ 提交于 2019-12-12 04:34:08

问题


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";


来源:https://stackoverflow.com/questions/12359259/xcode-write-nslog-result-in-uilabel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!