Customizing Toolbar Button Styling on iOS
If you want to use the stock toolbar buttons provided in PSPDFKit but with a different style, you can subclass AnnotationToolbar
. Please take a look at the Overriding Classes guide for more information. Ensure that you override the classes very early — before the toolbar buttons are accessed, since they are created lazily and changing the class once it’s created won’t affect anything.
In most instances, you’ll want to change the image
property or do something that UIKit doesn’t do or support by default. In such a case, you can create a customView
instead and return that in your subclass. Make sure you create it once and that you don’t recreate it every time customView
is accessed.
You can also use your own bar button items and simply call down to the action selector of the original button with your custom button as an argument.