I have developped a litle function to insert text in UITextView and scroll down automatically. It works fine with iOS 5 but since i have updated Xcode to Xcode 4.5 with iOS6, this method no longer works.
Could you help me ?
Here is this method :
- (void) insertTextInAPP : (UITextView*) tv : (NSString*) s {
NSRange range = {[tv.text length], 0};
[tv setSelectedRange:range];
[tv insertText:s];
[tv insertText:@"\n"];
range.location = [tv.text length];
[tv scrollRangeToVisible:range];
}
And i use this function like this :
NSString *newEventString = [[NSString alloc] initWithFormat : @"Test"];
[self insertTextInAPP:self.outPutTextView: newEventString];
It works just fine here (iOS 6, Xcode 5.5). Of course, I needed to change
(UITextView) tvto(UITextView*) tvand"Test"to@"Test", but other than that it was alright.What happens when you try it?