Randy Randy - 2 months ago 5
Objective-C Question

Add text to UItextField without erasing old text

I have an

, and I want to display the content of an array in it.
So I tried something like that (and then I realised it obviously wouldn't have worked):

for (NSInteger i=0; i<myArray.count; i++) {
[self.myTextField setText:myArray[i] ];

So, as you may guess, this code just displays the last element of my array in my text field.

My question: is it possible to edit the content of a text field, without erasing the content already present ?

Thanks a lot for your answers !



[self.myTextField setText:[[self.myTextField text] stringByAppendingString:myArray[i]]];