evgenyneu / Auk

An image slideshow for iOS written in Swift.
MIT License
277 stars 44 forks source link

How to loop images.... #49

Closed sirvon closed 7 years ago

sirvon commented 7 years ago

I would like to add 3 images to slideshow and keep them looping until i transition to next viewController...

How to accomplish this?

Thanks for lib

evgenyneu commented 7 years ago

Hi @sirvon, good question. First, you will need to put a scroll view to your storyboard and create an outlet in your view controller. Then you can add three images:

From a remote source

scrollView.auk.show(url: "https://bit.ly/auk_image")
scrollView.auk.show(url: "https://bit.ly/moa_image")
scrollView.auk.show(url: "https://bit.ly/auk_image")

From a local file

if let image = UIImage(named: "image1.jpg") {
    scrollView.auk.show(image: image)
}

if let image = UIImage(named: "image2.jpg") {
    scrollView.auk.show(image: image)
}

if let image = UIImage(named: "image3.jpg") {
    scrollView.auk.show(image: image)
}

Let me know if it works for you.

sirvon commented 7 years ago

it works but it doesnt loop. once the code runs it stops at image3

evgenyneu commented 7 years ago

Hi, @sirvon, sorry I must have misunderstood you. What exactly do you mean by looping? Do you want it to automatically scroll to from image to another until it reaches the third image and than scroll back to the first and start again? If so, you can start the autoscrolling with with the following code:

scrollView.auk.startAutoScroll(delaySeconds: 3)
evgenyneu commented 7 years ago

Closing the issue, feel free to open if needed.