I have this UITextView that is updated in a loop. Text is appended to the end of the text view at every loop. The textview updates but does not scroll to show the end of the text view.
The method I use to append the text is:
- (void)appendText:(NSString*)text toTextView:(UITextView *)textView
{
dispatch_async(dispatch_get_main_queue(), ^{
NSAttributedString* attr = [[NSAttributedString alloc] initWithString:text];
[[textView textStorage] appendAttributedString:attr];
[textView scrollRangeToVisible:NSMakeRange([[textView text] length], 0)];
[textView setNeedsDisplay];
[textView setNeedsLayout];
});
}
The textview updates with text but continues to show just the top.
this is compiled for iOS 7+ only.
Other answers on SO are not solving this.
any clues?