如何在Swift 3.0中使用performSegue?

时间:2018-11-02 07:55:43

标签: swift segue

@IBOutlet weak var viewHistory: UIView!
    @IBOutlet weak var viewGoal: UIView!



    override func viewDidLoad() {
        super.viewDidLoad()

        let tapHistory = UITapGestureRecognizer(target: self, action: #selector(goHistory))
        tapHistory.numberOfTapsRequired = 1
        tapHistory.numberOfTouchesRequired = 1
        tapHistory.isEnabled = true
        viewHistory.addGestureRecognizer(tapHistory)

        // Do any additional setup after loading the view.
    }

    @objc func goHistory(){

        self.performSegue(withIdentifier: "Segue_History", sender: self)

    }

enter image description here

在StoryBoard A中,我将触发的Segues设置为MyPage-> History。 所以我设置了segue标识符“ Segue_History”

当我点击MyPage中的视图时,goHistory函数会调用performSegue。

但是它会发生这样的错误。

    2018-11-02 16:43:45.875605+0900 
testApp[1729:436205] 
-[testApp.VC_History tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x106a83d40
    2018-11-02 16:43:45.891627+0900 
testApp[1729:436205] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[testApp.VC_History tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x106a83d40'

我认为我在segue设置了标识符,但事实并非如此。 你有什么想法吗?

0 个答案:

没有答案