evgenyneu / Auk

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

image slider is not empty after view loads #11

Closed bgdnr closed 8 years ago

bgdnr commented 8 years ago

Hi again,

I have another problem, maybe you can help me out. Here's the app structure: TableViewController -> ViewController (loads the details from the selected cell)

When I click on a cell, everything is loading great and the slider works like a charm. However, if I go back to the tableviewcontroller (using navigation controller) and click on the same or another cell, then the image slider will show both the images from the previous cell + the ones from the new cell.

Even if I call the scrollView.auk.removeAll()...the slider disappear but when I scroll, they still appear. I'm thinking maybe it's another problem related to custom size classes?

Here's a code snippet from the viewController:

@IBOutlet weak var scrollView: UIScrollView!

override func viewDidAppear(animated: Bool) {
    createScrollView()
}

func createScrollView(){
       for app in appArray { //I have an array of structs            
        if app.appId == self.appId {

//self.appId comes from the selected cell and I'm searching for the struct with that id for image in app.images { let url = image //array of urls self.scrollView.auk.show(url: url) } }

    }

}
bgdnr commented 8 years ago

Hmmm I think the problem is in my code. I'll update this thread later on.

evgenyneu commented 8 years ago

Hi, @boogdan, ok cool, let me know how it goes.

bgdnr commented 8 years ago

Hi, yes the problem was in my code. Somewhere deep down I forgot to empty a particular array before appending new values to it. As usual, the image slider is working spotless.

evgenyneu commented 8 years ago

I am glad it work, cheers.