Hauwa
Hauwa

Reputation: 11

Xcode (Multiple strings in one label)

I have two separate strings and i want them displayed in the same label. How do i do that with Xcode.

for example

1st string is called answer1 2nd string is called answer2

how do i make my label display both

Upvotes: 0

Views: 6376

Answers (1)

0xDE4E15B
0xDE4E15B

Reputation: 1294

[label setText:[NSString stringWithFormat:@"1st string is called %@ 2nd string is called %@", answer1, answer2]];

answering on your comment: have a look at the NSString Class Reference Namely stringByAppendingString:

NSString* string=@"";
for (int i=0; i<4; i++){
    string = [string stringByAppendingString:[NSString stringWithFormat:@"%d ", array[i]]];
}

Upvotes: 7

Related Questions