40media Scrolling to range in UITextView

Scrolling to range in UITextView

I have a UITextView with text in it, and I want to be able to scroll it such that a given NSRange of the text is at the top of the view. Using scrollRangeToVisible: does not work: it will scroll the range such that it is somewhere in the view, not necessarily where I want it to be. How can I scroll such that this specific NSRange of text in the UITextView is exactly at the top?

Thanks for any suggestions.

Stretching An Image in Tableview


UIWebView and Javascript from button
The only answer that comes to mind is to work out the contentOffset yourself.

sectioned UITableView
Use NSString -sizeWithFont:forWidth:lineBreakMode: sizeWithFont:constrainedToSize:lineBreakMode: to work out the size of the box immediately above the text you want (this may be tricky if the text doesn't have to start the line; you may have to try several ranges to find the one that causes the height to jump).

Cocoa-touch - implementation files?
That should give you the contentOffset you need for UIScrollView -setContentOffset:animated:.

Run javascript without UIWebView possible?
I'm a little worried about the performance, and it may turn out necessary to create your own implementation of UITextView to be efficient (which shouldn't be that difficult if it's static content)..
Creating a Navigation View inside the standard Flipside view?
It's not as elegant a solution as I'd like, but UITextView doesn't give you a lot of access to the layout engine..
HTTP POST with custom header from iphone to PHP script. How do you read the header?

indentationLevel property doesn't appear to do anything?

94 out of 100 based on 74 user ratings 874 reviews