Q:

UIImagePickerController inside UIPopoverController doesn't show Cancel button on iOS7

I'm using UIImagePickerController inside a UIPopoverController to select image just from photo albums. When I launch app on device running iOS 8, the Cancel button on the top right of the pop over appeared normally like this:

But when I launch the app on device running iOS 7, the Cancel button disappeared:

The code I used to show the picker:
    UIImagePickerController *pickerController = [[UIImagePickerController alloc] init];
    [pickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    pickerController.delegate = self;

    _popOver = [[UIPopoverController alloc] initWithContentViewController:pickerController];
    _popOver.delegate = self;

    pickerController.navigationBar.tintColor = [UIColor redColor];//Cancel button text color
    [pickerController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]}];// title color

    if (isImage) {
        [pickerController setMediaTypes:@[(NSString*)kUTTypeImage]];
    } else
        [pickerController setMediaTypes:@[(NSString*)kUTTypeMovie]];
    [_popOver presentPopoverFromRect:CGRectMake(1024/2, 768/2, 1, 1) inView:self.view permittedArrowDirections:0 animated:YES];

What can I do to show that Cancel button on iOS7? My app design doesn't allow user to dismiss the popover by tapping anywhere outside the popover view.
Thank you.

A:

@JozoL Write the Below Code this works     
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {

        UINavigationItem *pickerNavBarTopItem;
        // add done button to right side of nav bar
        UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel"
                                                                       style:UIBarButtonItemStylePlain
                                                                      target:self
                                                                      action:@selector(doSomething)];

        UINavigationBar *bar = navigationController.navigationBar;
        [bar setHidden:NO];
        pickerNavBarTopItem = bar.topItem;
        pickerNavBarTopItem.rightBarButtonItem = doneButton;
    }
    -(void)doSomething{

    }

