简体   繁体   中英

UITextField - watching for insertions and deletions in text

So, I am working on application that has some collaborative functions, like single text file being edited by multiple users at same time.

I need to implement operational transformation on the text like this http://operational-transformation.github.io (check the visualization http://ot.substance.io/visualization ).

I guess I can simply use that JS implementation in my application (using WebView or some derived bridge), thats is ok, but how do I watch these changes in text on UITextField? I need to watch insertions and deletions obviously (+ the position of both). I need to create the operations to be send to server and received from server.

So how do I do that or is there any working solution written in Objective-C for iOS?

UITextFieldDelegate and it's textField:shouldChangeCharactersInRange:replacementString: method.

I will keep this open for a few days for anyone who has any good suggestions for OT implementation for iOS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM