Question

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.

Était-ce utile?

La solution

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];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top