Reputation: 4325
On Click of a button the data in my TextView is appended. I want that when content reaches the end of the textView it should scroll automatically.
The data is appended by "\n"'s so what I need is to set the rectTovisile to he maximum Content Offset , but I dont know how to get the maximum content offset.
If you have any oher method doProvide.
codeBehind:
- (IBAction) onLap
{
NSString *lapCatch = ......;
myUITextView.text = [myUITextView.text stringByAppendingFormat:@"myData: %@ \n",lapCatch];
}
Upvotes: 1
Views: 306
Reputation: 23278
Try with this,
if (myUITextView.text.length > 0) {
NSRange range = NSMakeRange(myUITextView.text.length - 1, 1);
[myUITextView scrollRangeToVisible:range];
}
Upvotes: 1