Closed RajChanchal closed 7 years ago
Hello @RajChanchal, thanks for the question. If you are assigning the scroll view delegate please make sure it is done before showing the images.
// Assign the delegate BEFORE showing the images
scrollView.delegate = self
scrollView.auk.show(url: "https://bit.ly/auk_image")
scrollView.auk.show(url: "https://bit.ly/moa_image")
Let me know if it helps.
@evgenyneu No, it still is not updating the page control dots
, even if I assign the .delegate
property before calling the .show
methods. No doubt, the scrollView delegate methods are triggered by assigning the .delegate
property but page control dots don't update automatically.
This is my code:
scrlView.auk.removeAll()
scrlView.auk.settings.preloadRemoteImagesAround = 2
scrlView.auk.settings.contentMode = .scaleToFill
scrlView.auk.startAutoScroll(delaySeconds: 3)
scrlView.delegate = self
Moa.settings.requestTimeoutSeconds = 20
for slider in sliders{
scrlView.auk.show(url: slider.enclosure!)
}
let tapRecog:UITapGestureRecognizer = UITapGestureRecognizer.init(target: self, action: #selector(sliderTapped))
scrlView.addGestureRecognizer(tapRecog)
Oh, the delegate needs to be assigned before the auk
property is accessed. In your example, it needs to be:
scrlView.delegate = self
scrlView.auk.removeAll()
scrlView.auk.settings.preloadRemoteImagesAround = 2
...
Do you still have this problem, @RajChanchal?
Yes, the problem is still there. Sorry for non responsiveness, I thought of sending you a sample project instead. Haven't created yet, will send you by today.
Sample project will be helpful. As a rule of thumb, the scroll view delegate can not be assigned after the .auk
property is accessed, otherwise the page control will stop updating. I personally assign the delegate in viewDidLoad
before doing anything else.
This is how I was using the lib. And to my surprise it is working fine in the sample project. My bad, sorry. Attached is the sample project, I was using the slider in UITableViewCell. AukTester.zip
I am glad it worked.
I can see in the demo app that the scroll view delegate is assigned in a property sliders
setter which is then called from layoutSubviews
. There can be a problem with this, because layoutSubviews
can be called multiple times (during a screen orientation change, for example). This will assign the scroll view delegate again and the page control will stop working.
By assigning .delegate property, the dots stops updating. Only images scroll fine. Actually I wished to change a label based on the current slider. So to know if the slider has changed image, I needed to make my view controller a delegate of the uiscrollview and it stops changing dots...