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/