ios - UIImagePickerController 在 Swift 3 的图像编辑模式下更改底部栏按钮标题

标签 ios swift uiimagepickercontroller

enter image description here

I want to change the UIImagePickerController bottom bar buttons during image editing mode in swift 3, Xcode 8.2.1. Currently buttons are showing like as i mentioned in picture.

class MyController:UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

    @IBOutlet weak var imageV: RoundedImageView!

    let imagePicker = UIImagePickerController()

    override func viewDidLoad() {
        super.viewDidLoad()

        self.imagePicker.delegate = self
    }

    //MARK:- Action
    @IBAction func libraryButtonPressed(_ sender: Any) {
        self.imagePicker.allowsEditing = true
        self.imagePicker.sourceType = .photoLibrary
        self.present(self.imagePicker, animated: true, completion: nil)
    }

    @IBAction func cameraButtonPressed(_ sender: Any) {
        self.imagePicker.allowsEditing = true
        self.imagePicker.sourceType = .camera
        self.present(self.imagePicker, animated: true, completion: nil)
    }

    // MARK: - UIImagePickerControllerDelegate Methods

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

        if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
            self.imageV.contentMode = .scaleAspectFit
            self.imageV.image = pickedImage
        }

        self.dismiss(animated: true, completion: nil)
    }

    func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
        self.dismiss(animated: true, completion: nil)
    }
}

Please suggest me..

最佳答案

确保您没有在您的应用程序中使用本地化,如果您正在使用它,请正确配置所有字符串文件。

看看这个解决方案: https://stackoverflow.com/a/42008789/2898708

我添加了 PhotoLibrary.strings 并在其中添加了以下字符串

"CANCEL" = "Cancel";
/* Title of button to set contact photo */
"SET_PHOTO_BUTTON" = "Set Photo";

"CHOOSE_PHOTO_BUTTON" = "Choose";

"USE_PHOTO_BUTTON" = "Use Photo";

关于ios - UIImagePickerController 在 Swift 3 的图像编辑模式下更改底部栏按钮标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41831496/

相关文章:

swift - 如何获取WKWebView资源文件

ios - 错误域 = PlugInKit 代码 = 13 "query cancelled"UserInfo = {NSLocalizedDescription = 查询已取消} 与 Objective C Xcode 9.3 iOS 11

ios - 如何快速从 UIImage 获取图像扩展名/格式?

ios - 从核心数据中的一对多关系中删除对象

swift - 在 Firebase 中增加数据点的最简单方法?

iOS 不同的应用程序图标取决于所使用的设备

ios - WKWebView 全屏而不是框架?

iPhone-避免在 UIImagePickerController 中进行视频压缩

ios - 在 UIView 中循环遍历 UIButtons

iphone - 如何在 IOS 开发中刷新 "socket mobile"扫描仪缓冲区?