1

I need to highlight text in epub book,when user selects the text,i can get the text,what the user has selected,but i need to highlight,the text permanently what user selected,thanks,any help will ne appreciated.enter image description here

girish
  • 900
  • 12
  • 23

1 Answers1

1

There's nothing built in to iOS that will do this. Some broad techniques that might work:

  • If you're showing the book in a web view, you might be able to wrap that area in a span and style it to create a highlight.
  • If you're using Core Text, you could draw the highlight in directly, either before or after drawing the text. (Your choice will decide how the highlight affects non-black text.)
  • You could add a transparent view over the text that draws in the highlight.

As for adding highlight-related items to the selection menu, see this Stack Overflow post. You probably won't be able to get icons in the menu like Apple does, though; that seems to be a private API. You could probably override the whole menu system if you want something closer to Apple's look, but that'll be quite a bit of work.

Community
  • 1
  • 1
Becca Royal-Gordon
  • 17,541
  • 7
  • 56
  • 91
  • HI Brent,thanks for your response,at present i am showing this is webview,can u give me any idea how to wrap area with span using java script,any useful link. – girish May 23 '13 at 05:35
  • [This post on the DOM Selection object](http://stackoverflow.com/questions/6328718/wrapping-a-selected-text-node-with-span) might be a good starting point. – Becca Royal-Gordon May 23 '13 at 06:21