我們可以使用URL選項加載SDWebimage在本地設備上找到的圖像嗎?如果是的話,我試圖使用SDWebimage來顯示圖像,下面是我的代碼,我無法在imageview中加載圖像。它仍然空白。請幫助我理解我做錯了什麼?帶有URL的Swift加載(本地)圖像
func addImage(sender: AnyObject){
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){
picController.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum;
picController.allowsEditing = true
self.presentViewController(picController, animated: true, completion: nil)
}
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
let url = info[UIImagePickerControllerReferenceURL] as! NSURL
titleImageView.sd_setImageWithURL(url)
self.dismissViewControllerAnimated(true, completion: nil)
}
謝謝@shripada – vanquish