I am trying to assign randomly a UIImage
on my viewController from an array of images. However i always get the following error like on the screenshot below:
Asked
Active
Viewed 690 times
-6

dirtydanee
- 6,081
- 2
- 27
- 43

Matthew Harris
- 21
- 7
-
1Because quote images are an array of images! – Siyavash Oct 08 '17 at 06:45
-
1Please read this URL https://stackoverflow.com/help/how-to-ask – Santhakumar Munuswamy Oct 08 '17 at 06:45
-
And also what are you trying to do? Are you trying to access an image or adding an image ? – Siyavash Oct 08 '17 at 06:48
-
I am trying to generate a random image out of an array of images – Matthew Harris Oct 08 '17 at 06:54
1 Answers
-2
To get a random image from your QuoteImages array you have to first get a random value and then request that from your array
let randomValue = arc4random_uniform(10)+1
let randomImage = QuoteImages[randomValue]

Siyavash
- 970
- 9
- 23