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.

有帮助吗?

解决方案

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];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top