Tuesday, 15 May 2012

ios - UISwipeGestureRecognizer Custom Action with UITableView -


I'm trying to add a swipe gesture (left / right) to hide / show menus on my side It's working on a completely UIView, however, I'm having problems with UITableView.

Here's my code to add my swipe gestures to my table view:

/ / add right swipe gesture identifier rightSwipeGestureRecognizer = UISwipeGestureRecognizer (target: auto , Action: "toggleSideMenu") rightSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirection.Right self.timelineTableView.addGestureRecognizer // Skip left swipe gesture identifier go leftSwipeGestureRecognizer = UISwipeGestureRecognizer (target: auto, proceeding: "ToggleSide menu") Skipping Skype ZeroConogenerDrErption = UISwipeStainReconZingerDirring.lift //SetMenuContainerView Here's my selector method:
  function toggle side menu () {println ("Enter"). Swipe ") ToggleSystemModify ()} I have also done this:  
  function table view (table view: UITableView, editing style firerot and expresspace index: NSIndexpath) - & gt; UITableViewCellEditingStyle {Return UITableViewCellEditingStyle.None} Function Table View (Table View: UITableView, canEditRowAtIndexPath Index Path: NSIndexPath) - & gt;  

However, when I swipe left or right, my selector does not call the menu "ToggleSide Menu ()" anytime.

PS: I have also tried to add those swipe gestures directly to my UTTL watch but it also does not work properly.

Anyone have an idea? Thank you very much for your time!

Thanks to Kirit Modi here is the solution to my problem :

Add:

  leftSwipeGestureRecognizer.delegate = self rightSwipeGestureRecognizer.delegate = self  

then add UIGestureRecognizerDelegate delegate method :

  Function Gesture Tracker (gesture: UIGestureRecognizer, Resize Touch Touch: UITT) - & gt; Bull {returns true}  

No comments:

Post a Comment