Closed leandrodavimg closed 9 years ago
Hi, hmm, I do not know why it is not working with a single tap. (I assume that is what you are asking).
You can implement it this way:
The YiiPagedImages object has a delegate
property. That delegate has a tegPagedImagesCellViewDelegate_onImageTapped
method that is called when an image in the scroll view is tapped.
If it does not work for you, there is an alternative I wrote recently: https://github.com/evgenyneu/Auk. It will allow you to add a custom gesture recognizer to your scroll view like this:
func setupTap() {
let tapGesture = UITapGestureRecognizer(target: self, action: "respondToTap:")
scrollView.addGestureRecognizer(tapGesture)
}
func respondToTap(gesture: UITapGestureRecognizer) {
print("Tapped page \(scrollView.auk.currentPageIndex)")
}
Thanks, with your help managed to solve
Hello I'm using his great code, how can I add tap in scrollview
The code below works if it is equal to two ()
@IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var pageControl: UIPageControl! @IBOutlet var images: YiiPagedImages!
let TapRecognizer = UITapGestureRecognizer(target: self, action: "someAction:") TapRecognizer.numberOfTapsRequired = 2 //(must be 1) TapRecognizer.numberOfTouchesRequired = 1 scrollView.userInteractionEnabled = true scrollView.addGestureRecognizer(doubleTapRecognizer)