Why ibooks doesn't give text highlights and add notes functionality in fixed layout epub?

廉价感情. 提交于 2019-12-09 19:40:02

问题


Is it possible to add text highlights in fixed layout epub. I added text highlights and add notes in normalize epub by using bellow code:

    [webview stringByEvaluatingJavaScriptFromString:@" var selection = "";\
     var results = "";\
     var idspan = "";\
     "];
    [webview stringByEvaluatingJavaScriptFromString:@"if (window.getSelection) {\
     selection = window.getSelection();\
     }\
     if (selection.rangeCount > 0) {\
     var range = selection.getRangeAt(0);\
     var span = document.createElement(\"span\");\
     span.id = \"span_\" + range.startOffset + \"_\" + range.endOffset ;\
     span.setAttribute(\"class\",\"uiWebviewHighlight\");\
     span.setAttribute(\"onclick\",\"clickHandler(this)\");\
     span.style.backgroundColor  = \"skyblue\";\
     range.surroundContents(span);\
     selection.removeAllRanges();\
     selection.addRange(range);\
     results=span.id;\
     }"];

    [Span_id_Array addObject: [webview stringByEvaluatingJavaScriptFromString:@"results"]];


    - (void)textViewDidChange:(UITextView *)textView{
    NSLog(@"textViewDidChange:");
    [Selected_Notes_Array addObject:Notes_TxtView.text];
    [NotesDic setValue:[Selected_Notes_Array lastObject] forKey:[Span_id_Array lastObject]];
    // NSLog(@"Selected_Notes_Array:%@",NotesDic);
}

I can store and retrieve Notes and Highlights by this way in normalize epub. I am getting issues in fixed layout epub. I can select a single word. but i want to select multiple words & para. Some fixed layout epub book doesn't allow to select, i don't know why.

If anyone know about this means please help me.. Thanks in advance...

来源:https://stackoverflow.com/questions/15495447/why-ibooks-doesnt-give-text-highlights-and-add-notes-functionality-in-fixed-lay

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