Swift 相册照片选择

extension ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
      
    @IBAction func btnClick(sender: UIBarButtonItem) { 
        let vc = UIImagePickerController()
        vc.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
        vc.delegate = self
        
        self.presentViewController(vc, animated: true, completion: nil)
    }
    
    func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
        let image = info[UIImagePickerControllerOriginalImage] as! UIImage
        iamgeV.image = image
        picker.dismissViewControllerAnimated(true, completion: nil)
    }
    
}

你可能感兴趣的:(Swift 相册照片选择)