ios - How to load an image from a URL into a table section (with one row)? -


i have table consists of 6 sections, out of second section 1 row should loading image url.

i'm getting url plist file.

in cellforrowatindexpath function, i'm using following code :

if let url = nsurl(string: park.getimagelink()) {             if let data = nsdata(contentsofurl: url) {                  imageurl?.image = uiimage(data: data)            }  //park.getimagelink() gets url of image string plist file; var imageurl:uiimageview? declared property 

further, i'm using switch case load image correct section :

  switch(indexpath.section){           case park_image:                cell?.imageview?.image = imageurl?.image } // park_image's value 1 

when run code, can see contentsofurl: url has correct url, yet, imageurl?.image getting nil.

is approach load image url table section correct? if not, missing, or correct way load image table section? i'm new swift programming apologise if i'm making newbie mistake. appreciated.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -