是否可以在固定布局epub中添加文本高亮显示。我添加了文本高亮,并使用下面的代码在normalize代码中添加注释:
[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);
}
我可以通过这种方式在规范化epub中存储和检索Notes和Highlights。我在固定布局epub中遇到问题。我可以选择一个单词。但我想选择多个单词&段。一些固定布局的epub书不允许选择,我不知道为什么。
如果有人知道这意味着请帮助我..提前致谢...