0

I have been watching tutorials and looking/researching and I can't find anywhere how to create an array of image urls.

I am trying to use the framework SDWebImage. All the tutorials that I have been looking at do exactly what I need my app to do, but with a TableView not a normal ViewController. I also would like to have it where you push a button and then it will randomly call one of the images. The urls are from the images stored in Firebase Storage. This framework (SDWebImage) is really what I want to use because it does exactly what I want to do and makes it really quick and easy. The tutorial that was closest to what I am doing is except for Jared has his in a TableView. This video is exactly what I want meaning the way he did his code like that. I really like his tutorials and his code is nice.

Overview: I need a random image from the array to load right when the app is launched, and when you click the button I need it to load another random image. I looked into this framework because at the moment I will have 400 images and more coming in the future and it is super easy to do exactly what I want.

Please help me I have been searching for 2 days and I have no idea what to do! I know this is a pretty simple concept for having an array and for using this normal ViewController instead of a TableVIew.

All help is gladly appreciated.

Oussama Ben Ghorbel
  • 2,132
  • 4
  • 17
  • 34
Jaqueline
  • 465
  • 2
  • 8
  • 25

1 Answers1

0

According to the SDWebImage documentation, you can use the setImageWithURL to set each image view inside a cell set. That code can look something like this:

self.imageView.sd_setImageWithURL(url, completed: block)

I don't know if this is exactly what you are looking for! To get better answers from Stack Overflow it's always better to post segments of your code that are not working, with an explanation of what you have tried and what errors you are getting. See here for some tips on asking good Stack Overflow questions, and here for some types of questions you should avoid.

Hope it helps!

Potentially Useful Sources:

cosinepenguin
  • 1,545
  • 1
  • 12
  • 21
  • I am looking to set this up in a normal ViewController not a TableViewController or a CollectionView, that's what my problem/question is. Thank you SO MUCh for helping me!! – Jaqueline Jul 10 '17 at 01:54
  • Can you even set this up to have it pick a new/random image from an array of urls? Becuase I have searched everywhere and can not find anything. The only place where I saw an array of urls is in Jared's video because each link was for a different cell in a TableViewController. https://www.youtube.com/watch?v=XPAaxF0rQy0 – Jaqueline Jul 10 '17 at 03:24
  • Little late to the party, but on SDWebImage's main page, it does mention how to make this work with tableviews and collectionviews. Have you managed to make this work for you? – jlmurph Aug 07 '17 at 06:30