Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ashwinr87

macrumors member
Original poster
Mar 9, 2011
81
0
I load a HTML page into my UIWebView in my iPad project and the html contains a contenteditable div which allows users to enter text.

I am trying to figure out what event gets called when a user long presses on the UIWebView. The reason I am trying to figure this out is because, I want to get the current cursor position after the user has long pressed on the webview and moved the cursor to a position in the div.

I can get the current position of the cursor through javascript by doing this,

Code:
var selection = window.getSelection();
var node = selection.focusNode; // currently focused node
var ran = selection.getRangeAt(0); // current cursor position

So basically, I would use the same piece of code as soon as the user moves the cursor (through long press) to get the current cursor position. However, I am not able to figure out which event is called after/when the user long presses and moves the cursor.

It would be great if someone could help me out with this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.