La pregunta es casi autoexplicativa. Necesito establecer la propiedad de texto de una instancia de UILabel en un int. ¿Cómo voy a hacer esto? Lo siento si es una pregunta nooby.¿Configurando el texto de un UILabel en un int?
Gracias!
La pregunta es casi autoexplicativa. Necesito establecer la propiedad de texto de una instancia de UILabel en un int. ¿Cómo voy a hacer esto? Lo siento si es una pregunta nooby.¿Configurando el texto de un UILabel en un int?
Gracias!
Suponiendo que tienen:
UILabel *myLabel; //instance of your label
int myInt; //the integer you need to set as text into UILabel
se puede hacer esto, y es bastante simple:
[myLabel setText:[NSString stringWithFormat:@"%d", myInt]];
o:
myLabel.text = [NSString stringWithFormat:@"%d", myInt];
label.text = [NSString stringWithFormat:@"%i",intNumber];
NSNumber *number = [NSNumber numberWithInt:yourInt];
[yourLabel setText:[number stringValue]];
Pruebe esto:
[label setText:[NSString stringWithFormat:@"%d", intValue]];