I am making a an app that has a UITextView
and a button.
When I click the button some text will add in the UITextView
.
But when clicking the button, I wan't to scroll down to the bottom of the text field so the user can see the last text added.
How to make the UITextView
to scroll down to the bottom?
I tried:
int numLines = LogTextView.contentSize.height / LogTextView.font.lineHeight+1;
NSLog(@"%d",numLines);
NSUInteger length = self.LogTextView.text.length;
self.LogTextView.selectedRange = NSMakeRange(0, length);
but it will not work...
I also tried:
self.LogTextView.contentSize=CGSizeMake(length,0);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…