Auk
Auk copied to clipboard
Touch Event
Hi, I love this library, it's much simpler and clearer than other carousel libraries. I wonder if there is a simple way to handle touch events on each image.
For now, I'm adding a guesturerecognizer to the scrollview and detecting touch events with currentPageIndex. I just wanted to know if there's a more elegant way :)
let gesture = UITapGestureRecognizer(target: self, action: #selector(touchedScrollView))
scrollView!.addGestureRecognizer(gesture)
func touchedScrollView(sender: AnyObject) {
print("touch \(scrollView!.auk.currentPageIndex)")
}
Hi @flyingmate, thanks for the compliments and good question. No, there is no shortcut of doing that currently unfortunately. Maybe we should create one, something like:
scrollView.auk.didTap = {
// User has tapped the scroll view
}
Feel free to submit a pull request.
@evgenyneu its available when touch indexed slider open the links ?
Hi @mrsnax, sorry I did not quite understand your question. Can you explain a bit more please?
Hi @evgenyneu I love this library too! I have a couple of questions:
Can you disable the user tap? Meaning can I stop them from changing the slides? I am trying to have the sync to an audio timing so i do not want user Input.
And can you have those slides as FullScreen? for portrait and landscape?
Thanks :)
Hi again, @bertadevant.
One can prevent user from interacting with a view by settings its isUserInteractionEnabled
to false
.
scrollView.isUserInteractionEnabled = false
Or you can do the same in the storyboard by unchecking the "User Interaction Enabled" property in the Attributes inspector:
![user_interaction_enabled_xcode](https://cloud.githubusercontent.com/assets/880411/20500309/026330c0-b089-11e6-9879-9777447ab700.png)
As for the full screen, I have answered it in #53. Let me know how it goes.
How to disable touch event and keep the slide gesture as it is? Make isUserInteractionEnabled false will stop even the slide gesture too.
Hi @alfazeeweb, could you explain what you want to achieve in more detail? I don't quite understand what you mean.
@evgenyneu Thanks for the quick response, I have a table view that contains cells having the scroll view and other data relate to the cell. Now, if a user taps on the cell, the tap is consumed by the scrollview, and the 'didTapTableViewcell' isn't called. Attached is an image of my view:
Good question, I do not know how to do this, sorry. Maybe try searching on stackoverflow? Nice app design by the way. :)