Domanda

In my storyboard I have a tableview with buttons. I want to custom assign float and int value to the button.

I have assigned a label with players.text= Player.player; but I don't know to assign the button with float or int value.

È stato utile?

Soluzione

This is how to set button title,

for int value:

[button setTitle:[NSString stringWithFormat:@"%i", intValue] forState:UIControlStateNormal];

for float value:

[button setTitle:[NSString stringWithFormat:@"%0.1f", floatValue] forState:UIControlStateNormal];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top