UIImagePickerController inside UIPopoverController doesn't show Cancel button on iOS7

前端 未结 3 1168
甜味超标
甜味超标 2021-01-25 10:13

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 r

3条回答
  •  天涯浪人
    2021-01-25 10:30

    @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{
    
        }
    

提交回复
热议问题