Individual annotations when using multi-select


I’m using v. 8.1.2 of the iOS SDK and trying to figure out how to “see” which annotations are included when the user uses the multi-select tool.

I’m overriding a function:

toolManager(_ toolManager: PTToolManager, shouldShowMenu menuController: UIMenuController, forAnnotation annotation: PTAnnot?, onPageNumber pageNumber: UInt) → Bool

So that I can inject my own menu item when the menu pops up. My menu item triggers on action on whatever annotation triggers that call. This works perfect! No issues at all.

But if the user uses the multi-select tool and grabs more than one annotation, that function only gets called once, and it kinda looks like the SDK is creating some sort of “temporary” annotation to represent what the user selected.

Is there any kind of “for annotation in selectedAnnotations” that I can iterate over? Or even some way of recognizing that the user triggered that function via the multiselect? (i.e. as a last resort, I could maybe just hide my menu item in that case)


Hello Randy,

When multiple annotations are selected, that callback passes the first annotation only. You can get the complete list of annotations by checking the currently active tool:

((documentController.toolManager.tool) as? PTAnnotEditTool)?.selectedAnnotations

Please let me know if this helps.


This works like a champ! Thanks James! :slight_smile:

Great, thanks for letting us know.