0
votes

I am wondering how Amazon did the highlight/note popup buttons in the Kindle app. After reading about UIPasteboard, UIMenuController, UIResponder, and UIResponderStandardEditActions, I am able to turn on or off standard edit actions (i.e. copy, cut, paste, select, and selectAll). However I haven't found a way to add a custom action yet. I would really appreciate it if I could get a pointer.

Thanks in advance!

Chris

alt text
(source: sampletheweb.com)

Edited by balexandre (added image instead link)

6

6 Answers

3
votes

It looks like Amazon implemented their own custom view that mimicked the appearance of UIMenuController. I believe they did this rather than use SPI because if you click and hold on the Highlight cell, the arrow does not highlight, when it does in the real UIMenuController.

1
votes

I don’t think there is a public interface to these controls, you’d probably have to code them yourself. (Or maybe figure out the private API, but that’s a slippery slope.) I am not sure about that, though, maybe somebody will prove me wrong.

0
votes

That's a good point about the arrow part of the Notes/Highlight popup menu not highlighting, so they must be implementing their own.

However they are also obviously using a UIWebView, because it's recognizing tap and hold and they can highlight the text, and you can't get touch events from a UIWebView, much less get the information about what's selected. So how are they doing that?

This would be very useful for us to be able to do as well.

0
votes

Custom menu items can be added via the UIMenuController's menuItems property. See Apple's UIMenuController docs.

-3
votes

the javascript part can be managed with jQuery, that's a fair simple and powerful library. i'm using it for resizing and rearranging things in a webview and it works great :)