//我需要有关如何将数据从UIImagePickerController传递到UIImageView的帮助,这与我正在开发的更大的程序不同
BindUtils.postNotifyChange(null,null,this,"totalSoldDF");
//这是我的问题*********************************
import Foundation
import UIKit
import MessageUI
class ImageSelect: UIViewController, UINavigationControllerDelegate , UIImagePickerControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
func selectedImage(){ //func to choose a Picture from the library
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.photoLibrary){
let imgSelected = UIImagePickerController()
imgSelected.delegate = self
imgSelected.sourceType = UIImagePickerControllerSourceType.photoLibrary;
imgSelected.allowsEditing = true
self.present(imgSelected, animated: true,completion: nil)
我该如何解决这个问题,错误来自:类型' UIImagePickerController'没有会员'形象' 。我知道他们不是同一类型,但我不知道还有什么可以放
答案 0 :(得分:0)
您无法获取图像,因为您需要使用imagePickerController的委托方法来挑选所选图像。
选择图像时会自动调用此方法
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
self.dismissViewControllerAnimated(true, completion: nil)
let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
imgSelected1.image = selectedImage
}