Search code examples
iphoneuiscrollviewuitextviewios4uitextviewdelegate

iOS4: Can't Programmatically Scroll to Bottom of UITextView


Before I was using this method....

//TextView is a UITextView 

[TextView scrollRangeToVisible:NSMakeRange([TextView length], 0)];

...which would programmatically scroll to the end of the UITextView but it doesn't seem to be working in iOS 4.0. Is there a way to programmatically scroll to the end of a UITextView without changing editablility or inserting a point (where the user can tap on the UITextView and have a keyboard show up)?

Also, do I need to assign the file owner as the delegate? Does it make a difference?


Solution

  • UITextView doesn't have length property. Following code works good for my environment.

    [TextView scrollRangeToVisible:NSMakeRange([TextView.text length], 0)];