How to change cancel button title in UIImagePickerController?

前端 未结 6 1535
再見小時候
再見小時候 2021-01-15 06:46

Currently I\'m working on a multi-language application and I want to change the Cancel ,Use and Retake button titles of the UIIm

6条回答
  •  甜味超标
    2021-01-15 07:17

    Assign delegate as self to your imagepicker controller and add the following code :

    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
         UINavigationItem *ipcNavBarTopItem;
    
        // add done button to right side of nav bar
        UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@\"Done\"
                                style:UIBarButtonItemStylePlain 
                                target:self 
                                action:@selector(saveImages:)];
    
        UINavigationBar *bar = navigationController.navigationBar;
       [bar setHidden:NO];
           ipcNavBarTopItem = bar.topItem;
           ipcNavBarTopItem.title = @\"Pick Images\";
       ipcNavBarTopItem.rightBarButtonItem = doneButton;
    }
    

提交回复
热议问题