0
照片庫的圖像未顯示。 我的應用程序就像是 my app未顯示照片庫的圖像
我在此應用程序的目標是2 points.First的事情是,當我把「PhotoSelect」按鈕,我可以選擇的照片庫的image.Second的事情是在UIImageView的要顯示的圖書館的形象,但這是不能做到的。我可以訪問照片庫,選擇圖片但圖片不顯示。 PhotoController是
import Foundation
import UIKit
class PhotoController:UIViewController,UINavigationControllerDelegate,UIImagePickerControllerDelegate{
@IBOutlet weak var myImageView: UIImageView!
@IBAction func PhotoSelect(_ sender: Any) {
let myPickerController = UIImagePickerController()
myPickerController.delegate = self;
myPickerController.sourceType = UIImagePickerControllerSourceType.photoLibrary
self.present(myPickerController, animated: true, completion: nil)
}
@IBAction func PhotoSend(_ sender: Any) {
}
private func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject])
{
myImageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
self.dismiss(animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//myImageUploadRequest()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
我認爲連接正常,那麼必要的代碼是不是在PhotoController,對吧?但我不知道該代碼添加這個PhotoController.How可以解決這一問題?
是你的應用程序粉碎? –
我不知道暗戀與否 – user8080149
然後運行您的代碼並檢查它 –