2017-01-24 1 views
1

enter image description hereUIImagePickerController changer le titre du bouton de la barre inférieure en mode d'édition d'image à Swift 3

Je souhaite modifier les boutons de la barre en bas UIImagePickerController en mode d'édition d'image en rapide 3, Xcode 8.2.1. Actuellement les boutons montrent comme je l'ai mentionné dans l'image.

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) 
    } 
} 

S'il vous plaît me suggérer ..

+0

Le titre "CHOOSE_PHOTO_BUTTON" ressemble à une clé de localisation. Essayez la recherche globale ce mot-clé dans le projet, peut-être qu'il est défini quelque part. –

Répondre

0

Assurez-vous que vous n'utilisez pas la localisation dans votre application, si vous utilisez, puis configurer correctement tous vos fichiers de chaîne.

Jetez un oeil à cette solution: https://stackoverflow.com/a/42008789/2898708

J'ai ajouté PhotoLibrary.strings et j'y ajoute les chaînes suivantes

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

"CHOOSE_PHOTO_BUTTON" = "Choose"; 

"USE_PHOTO_BUTTON" = "Use Photo";