Open Abhishek-NickelFox opened 7 years ago
@nicklockwood : PLz help
This is how I do it for .rotary type This code I have got from some issue described here, can't remember which one it was. I suggest you to go through some of the issues and read them. It is very informative.
@IBOutlet var carouselView: iCarousel!
override func viewDidLoad() {
super.viewDidLoad()
carouselView.dataSource = self
carouselView.delegate = self
carouselView.type = .rotary
carouselView.isScrollEnabled = false
carouselView.isPagingEnabled = true
let swipeGestureLeft = UISwipeGestureRecognizer(target: self, action: #selector(self.swipeCarouselLeft))
swipeGestureLeft.direction = .left
carouselView.addGestureRecognizer(swipeGestureLeft)
let swipeGestureRight = UISwipeGestureRecognizer(target: self, action: #selector(self.swipeCarouselRight))
swipeGestureRight.direction = .right
carouselView.addGestureRecognizer(swipeGestureRight)
}
func swipeCarouselLeft(sender: UISwipeGestureRecognizer) { carouselView.scroll(byNumberOfItems: 1, duration: 0.1) }
func swipeCarouselRight(sender: UISwipeGestureRecognizer) { carouselView.scroll(byNumberOfItems: -1, duration: 0.1) }
I tried it with your .timeMachine type, it worked as well.
@6axter82 : i 'm using in vertical direction
Currently using time machine type and need to scroll to just next item . irrespect of how fast i have scrolled in screen