The question is largely self explanatory. I need to set the text property of a UILabel instance to int. How can I do it? Sorry if this is a nooby question.
Thanks!
Assuming you have:
UILabel *myLabel; //instance of your label int myInt; //the integer you need to set as text into UILabel
you can do this and it is pretty simple:
[myLabel setText:[NSString stringWithFormat:@"%d", myInt]];
or
myLabel.text = [NSString stringWithFormat:@"%d", myInt];
NSNumber *number = [NSNumber numberWithInt:yourInt]; [yourLabel setText:[number stringValue]];
label.text = [NSString stringWithFormat:@"%i",intNumber];
Try the following:
[label setText:[NSString stringWithFormat:@"%d", intValue]];
Source: https://habr.com/ru/post/910689/More articles:How to create a list with defvar in emacs - listreturn date paypal - dateHow to ignore the main method from a dynamic linked library in C ++ - c ++How can I optimize a MySQL query for an update? - optimizationhow to prevent memory leak in javascript - garbage-collectioncan we have main () in the interface and different implementations for main () in the classes implementing this interface? - javaHow to stop all worker threads in an Android application - javaSingle AdMod instance in all ViewControllers - ioshide part of text html, css, javascript - javascriptThe default directory, where are the new classes stored? - visual-c ++All Articles