美文网首页swift编程开发
Swift 相册照片选择

Swift 相册照片选择

作者: 小黑Swift | 来源:发表于2016-03-06 15:23 被阅读95次
    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 相册照片选择

        本文链接:https://www.haomeiwen.com/subject/jtsakttx.html