How to Customize the Navigation & Tool Bars on iOS

Some times you may want to hide or restrict certain features of the default reader capability whereas in other occasions you’ll need to change the look and feel of your PDF reader. This can be done by customizing the PlugPDFDocumentViewController.

The PlugPDF SDK’s PlugPDFDocumentViewController class offers a simple way to put PDF reading capabilities in your app. Below are shown three different ways to customize it.

  1. How to show/hide default menu items on the navigation bar
  2. How to add a custom menu item to the navigation bar
  3. How to make a custom navigation/tool bar

How to show/hide default menu items on the navigation bar

The left image below shows the default navigation bar with a number of different items.


If you only want to leave the Rotate View, Display Mode, Brightness and Outline button items, call the setMenuItems method as described below.

These are the arguments required by setMenuItems.


Similarly, when you want to hide the Edit button item only:

Use the line of code below.

The operation is the same as


How to add a custom menu item to the navigation bar

Let’s now add a special action button to the navigation bar as it is shown on the right picture below.


In this sample code, we use the btn_copy_on.png resource in the PlugPDF.bundle to make UIBarButtonItem. On the other hand, note how addLeftBarButtonItem: and addRightBarButtonItem: are used in the PlugPDFDocumentViewController.

When you tap the button you add, the target class’ action is called, so the following action method must be implemented in the target class.

How to make a custom navigation/tool bar

Now it’s time to customize the navigation/tool bar background image of the PlugPDFDocumentViewController.

First of all, create your own PlugPDFDocumentViewControllerDelegate. In the sample project, the TableViewController (the superview of the PlugPDFDocumentViewcontroller) is the delegate.

After that, add the below protocol method in the delegate class to know view did load. In that protocol method, you can edit the navigation/tool bar background image.

The final step is to set the delegate class that you previously made as the PlugPDFDocumentViewControllerDelegate using setDocumentViewControllerDelegate: in the PlugPDFDocumentViewController.

Additionally, if you want to recover something after dismissing the PlugPDFDocumentViewController use this protocol method.

8 replies
  1. kim
    kim says:

    hi, i’m developing IOS customizing but got a problem,
    i want to add custom icon like white, black icon, but any icons turn over blue icon…
    How can i add normal icon? thanks..

  2. Khaled Annajar
    Khaled Annajar says:


    I tired Number (3) How to make a custom navigation/tool bar and I got the view did load method not called.

    I use this code

    PlugPDFDocumentViewController *pdfController;
    @try {
    pdfController = [PlugPDFDocumentViewController initWithPath:pathToFile password:password title:title];

    [pdfController setEnableNightMode:[TFSSettingsBL sharedInstance].nightModeEnabled];
    [pdfController setEnableUseRecentPage:YES];
    TableViewController *delegate = [[TableViewController alloc] init];
    [pdfController setDocumentViewControllerDelegate:delegate];

    @catch (NSException *exception) {
    NSLog(@”Exception %@ %@”,, exception.description);

    if (pdfController) {
    [self.navigationController pushViewController:pdfController animated:YES];

    if ([[UIDevice currentDevice].systemVersion hasPrefix:@”7″] ||
    [[UIDevice currentDevice].systemVersion hasPrefix:@”8″]) {
    [pdfController setAutomaticallyAdjustsScrollViewInsets:NO];

  3. Khaled Annajar
    Khaled Annajar says:

    It worked after I changed the code replacing self with viewController like this:

    – (void)viewDidLoad:(PlugPDFDocumentViewController*)viewController
    //This is how to custom navigation bar background image. In this code we make it nil for example.
    [viewController.navigationController.navigationBar setBackgroundImage: nil
    forBarMetrics: UIBarMetricsDefault];

    //This is how to custom tool bar background image. In this code we make it nil for example.
    [viewController.navigationController.toolbar setBackgroundImage: nil
    forToolbarPosition: UIToolbarPositionBottom
    barMetrics: UIBarMetricsDefault];

  4. Dr. Plug
    Dr. Plug says:

    Hi Khaled

    i’m glad to hear that you solve that problem.
    If you have a another question, Don’t hesitate. and Please contact us.

    Best Regards,

  5. skt
    skt says:

    Hi ,

    I have an URL and want to show pdf in the viewcontroller .
    Here is my code which is triggered when I tap on button :
    – (void)showPDF:(id)sender {

    @try {

    [PlugPDFDocumentViewController initWithUrl:[NSURL URLWithString:@””] password:@”” viewController:self documentViewControllerDelegate:nil annotEventDelegate:nil textSelectionEventDelegate:nil documentViewDelegate:nil];
    @catch (NSException *exception) {
    NSLog(@”Exception %@ %@”,,exception.description);

    It is showing PDF within PDFDocumentViewcontroller but i want to show pdf under MyViewcontroller where application navigation bar is there and want to show PDFDocumentViewcontroller.

    Please suggest me .
    Thanks .

  6. Dr. Plug
    Dr. Plug says:

    Hello skt,

    We are sorry for the delay.
    You can put PlugPDFDocumentViewController under MyViewcontroller and hide the built-in navigation bar. Then create your own navigation bar outside MyViewcontroller.
    To hide the navigation bar, please refer the code snippet below.

    – (void)viewDidLoad:(PlugPDFDocumentViewController*)viewController
    [viewController setEnableTopBar: NO];
    [viewController setEnableBottomBar:NO];


  7. Frank
    Frank says:

    Hi, i want to create my custom navigation bar in my custom view controller, that is showing a document view with a pdf, how can i link my navigation bar with some buttons with the actions called from the plug pdf view controller?
    example: i want to create my navigation bar in my own view controller with a button that call the add annotation selector.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *