ios - About WebCache's sd_setImageWithURL with swift -
i'm using webcache
swift.
when set string
sd_setimagewithurl
directly following, it's displayed correctly.
imageview?.sd_setimagewithurl(nsurl(string: "http://imgfp.hotp.jp/imgh/86/49/p018678649/p018678649_238.jpg"), placeholderimage: nil, options: sdwebimageoptions.cachememoryonly, completed: {[unowned self] (image: uiimage!, error: nserror!, type: sdimagecachetype, url: nsurl!) -> void in ....
but, set following, it's not displayed..
if let imageurl:string = shop.img { print(imageurl) // same above self.imageview?.sd_setimagewithurl(nsurl(string: imageurl), placeholderimage: nil, options: sdwebimageoptions.cachememoryonly, completed: {[unowned self] (image: uiimage!, error: nserror!, type: sdimagecachetype, url: nsurl!) -> void in .... }
what's wrong??
it's simple:
if let strimage = "http://imgfp.hotp.jp/imgh/86/49/p018678649/p018678649_238.jpg"{ self.imageview.sd_setimagewithurl(nsurl(string: strimage), completed: { (img, error, type, urls) in }) }
use imageview.image
display wherever want.
Comments
Post a Comment