Changing the Design of the Default Buttons


If you want to use the stock toolbar buttons provided in PSPDFKit but with a different style, you can use overrideClass:withClass: on the classes to override them with your custom class. Ensure that you override the classes very early, before the toolbar buttons are accessed, since they are created lazily and changing the class once created won't change anything.

In most instances you want to change the image property or do something that UIKit doesn't do or support by default (like getting rid of the button shadow on iOS 6). In that case you can create a customView instead and return that in your subclass. Make sure you create that once and not recreate it every time customView is accessed.

If the button you override uses a systemStyle, you need to override that as well and return (UIBarButtonSystemItem)-1 which means no system style.

You can also use your own bar button items and simply call down to action: with your custom button as argument.

Was this page helpful? We're happy to answer any questions.