Reputation: 737
I am sorry of the question, but i have searched but i have not found the solution. I have a textField, and i would like to add a caractère to the text of my textField. how to do this, please ?
if ( myConddition) {
otherTextField.text = myTextField.text ( a would like to add a caractér("1") to the first position ).
thanks for your answers
Upvotes: 0
Views: 165
Reputation: 4239
Assuming you've created @property declarations...
[[self otherTextField] setText:[NSString stringWithFormat:@"1%@", [[self myTextField] text]]];
P.S. Eww at the use of dot notation by you boys and girls.
Upvotes: 0
Reputation: 90117
otherTextField.text = [@"1" stringByAppendingString:myTextField.text];
Upvotes: 0
Reputation: 31730
Use below
NSMutableString* myString = [NSMutableString alloc] appendFormat:@"%@%@",@"1", myTextField.text]];
myTextField.text = myString;
[myString release];
Upvotes: 0
Reputation: 135578
otherTextField.text = [NSString stringWithFormat:@"1%@", myTextField.text];
Upvotes: 1