Objective-c Novice - Needs help with string with variable

Posted by user544006 on Stack Overflow See other posts from Stack Overflow or by user544006
Published on 2010-12-23T01:32:32Z Indexed on 2010/12/23 1:54 UTC
Read the original article Hit count: 592

Filed under:
|
|

Im trying to get my label to print out "your score is ."

All i can find online is how to print using printf:

int score=2;
printf("You scored %i", score);

But this does not work when using the setText method. I have also tried

labelAnswer.setText:("You scored %i", score);
[labelAnswer setText:("You scored %i", score)];

But these do not work. I get an error: "request for member in something not a structure or union" Can anyone help?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c