Text Highlighting and add notes function in epub reader ios

我的梦境 提交于 2019-11-30 16:43:43

I have implemented all these for native epub player of androd and iOS- its a product R&D for an organisation

Instead of using getSelection follow the below steps.Its tedious but functionality would be fully under your control

-> Give url to UIWebView (iOS) or WebView (android)

-> in call back of webview didload - wrap all text words into spans with unique ids

-> propagate touch events to webview- javascript will handle those touches using function onTouchMove(e)

-> get touched span using document.elementFromPoint

-> highlight those spans (words) -> You will get position of each span $('#wordID-'+sWordID).position(),you can pass those values from javascript to native code

-> Add sticky notes view to the super view of webview

Note: better inject jQuery in run time into webview for wrapping words into spans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!