I have to customise UIImagePickerController
(adding left bar button item and removing right bar button item) as follows:
I tried to achieve this:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if([navigationController isKindOfClass:[UIImagePickerController class]]) {
[viewController.navigationItem setTitle:@"Gallery"];
UINavigationBar *bar = navigationController.navigationBar;
UINavigationItem *top = bar.topItem;
UIBarButtonItem *leftBarNuttonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"CancelIcon"] style:UIBarButtonItemStylePlain target:self action:@selector(dismissImagePickerView)];
top.rightBarButtonItem = nil;
top.leftBarButtonItem = leftBarNuttonItem;
}
}
But it is not happening. Help me to resolve it.
According to Apple documentation: https://developer.apple.com/reference/uikit/uiimagepickercontroller