How do we get the on-screen location of a selection in UIWebView
? That is whenever the user selects some text and the system displays the selection box, I want to know what is the bounding coordinate of the rectangle in screen (or view) units.
The reason for this that I want to display a UIPopoverController
that has an arrow pointing to the selection rectangle.
I've tried getting the selection via the JavaScript call window.getSelection()
but it seems that both the resulting Selection
and Range
JavaScript objects could not point to the exact screen (or document) relative point (pixel) coordinate since they are not atomic DOM nodes.
Thanks.