-4

i have error in func createDetailView() this function

enter image description here

 

func handleProductGesture(recognizer : UISwipeGestureRecognizer) {

    if(UISwipeGestureRecognizerDirection.Left == recognizer.direction)
    {
     self.rightScrollBtnPressed(nil)
    }
    if(UISwipeGestureRecognizerDirection.Right == recognizer.direction)
    {
      self.leftScrollBtnPressed(nil)
    }


}

func createDetailView() { scrollView.contentSize = CGSizeMake(CGFloat(320*(pageImages.count)), scrollView.frame.height) scrollView.showsHorizontalScrollIndicator = false scrollView.scrollEnabled = false scrollView.bounces = false

    let rightSwipe = UITapGestureRecognizer(target: self, action: Selector(handleProductGesture()))
    rightSwipe.direction = UISwipeGestureRecognizerDirection.Right
    rightSwipe.delegate = self

    view.addGestureRecognizer(rightSwipe)

    let leftSwipe = UITapGestureRecognizer(target: self, action: Selector(handleProductGesture()))
    leftSwipe.direction = UISwipeGestureRecognizerDirection.Left
    leftSwipe.delegate = self
    view.addGestureRecognizer(leftSwipe)

     next = indexNumber-1
    self.rightScrollBtnPressed(nil)

}

Gaurav Verma
  • 101
  • 6

1 Answers1

1

The issue is with your selector passing code. You need to specify the method names as string there, in your code you are trying to invoke it.

Change those to:

let rightSwipe = UITapGestureRecognizer(target: self, action: Selector("handleProductGesture:"))

let leftSwipe  = UITapGestureRecognizer(target: self, action: Selector("handleProductGesture:"))
Midhun MP
  • 103,496
  • 31
  • 153
  • 200