Swift: Make button trigger segue to new scene

前端 未结 3 1757
挽巷
挽巷 2020-12-14 02:12

Alright, so I have a TableView scene and I\'m going to put a button in each of the cells and I need each cell to, when clicked, segue to its own

3条回答
  •  失恋的感觉
    2020-12-14 02:33

    Use self.performSegueWithIdentifier("yourViewSegue", sender: sender) under your event for handling button's click:

    @IBAction func redButtonClicked(sender: AnyObject) {
        self.performSegueWithIdentifier("redView", sender: sender)
    }
    

    In the above code, redView is the segue identifier.

提交回复
热议问题