Raphael Lim Raphael Lim - 4 months ago 8
Objective-C Question

Repeating my text on my textView Objective C

How do I make the following script repeat the text input into it?

self.textView.text = self.userTextInput


The above script was written as a text input from a
ViewController
but I want it to loop 10 times in its text viewer, how do I write that?

thanks.

Answer

Use following code to get your desired result.

NSMutableString *teststring = [NSMutableString string];
for(int i = 0; i<10;i++)
{
[teststring appendString:self.userTextInput];
}
self.textView.text = teststring;