سؤال

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