0
votes

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    if segue.identifier == "editinfo"{

        let selecteditem: NSManagedObject = items[self.tableView.indexPathForSelectedRow!.row] as! NSManagedObject

        let viewcon: addViewController = segue.destinationViewController as! addViewController

        viewcon.usernameupdate = selecteditem.valueForKey("username") as! String
        viewcon.emailupdate = selecteditem.valueForKey("email") as! String

        viewcon.existeditem = selecteditem

    }

i tried the following but always the segue trigered on single tap

let doubleTap = UITapGestureRecognizer(target: self, action: nil)
       doubleTap.numberOfTapsRequired  = 2
     doubleTap.numberOfTouchesRequired  = 1
       cell.addGestureRecognizer(doubleTap)
1
Try with doubleTap.numberOfTouchesRequired = 1, I have a very similar code here, working as expected.Ulysses
i already tried doubleTap.numberOfTouchesRequired = 1 but same result.gsmpaloma
try adding this line, and see if it solves the problem. doubleTap .delaysTouchesBegan = trueUlysses
doubleTap .delaysTouchesBegan = true not solved the problem, is it possible to post your code?gsmpaloma
I put as an answer, you can do a sample project to test it, in the simulator works fine, my code in other projects are the same and work fine in the device too. Check, and see if it works.Ulysses

1 Answers

1
votes

Check my code to double tap, its very simple.

You can put in a sample project, for debug, maybe something else is blocking your code to work properly.

override func viewDidLoad() {
    super.viewDidLoad()

    let doubleTap = UITapGestureRecognizer(target: self, action: "doubleTapHandler")
    doubleTap.numberOfTapsRequired = 2
    view.addGestureRecognizer(doubleTap)
}

func doubleTapHandler() {
    print("double tap")
}