Reputation: 177
I am trying to add the character "1" to the existing value of a textbox "output" in Xcode objective-C.
I am trying to use the "stringByAppendingString" function, and have looked at some examples and can't seem to get this to work.
Is my syntax just wrong?
- (IBAction)pressOne:(id)sender {
NSString *str1 = output.text;
output.text = [str1 stringByAppendingString:[@"1"];
}
Upvotes: 4
Views: 8403
Reputation: 15597
Get rid of the stray bracket before the @
symbol:
output.text = [str1 stringByAppendingString:@"1"];
Upvotes: 4
Reputation: 27506
Remove the brackets:
output.text = [str1 stringByAppendingString:@"1"];
Upvotes: 0