程序性的视角

时间:2015-10-29 15:16:30

标签: ios swift segue

我正试图在视线上点亮一个屏幕。我有以下代码:

func addSegEvents(){
        let currentWeekTapper = UITapGestureRecognizer(target: self.view, action:Selector("segToCurRoster"))
        currentWeekTapper.cancelsTouchesInView = false
        self.currentWeekView?.addGestureRecognizer(currentWeekTapper)

    }

func segToCurRoster(){
    self.performSegueWithIdentifier("landingToCurRoster", sender: self)
}

我在viewDidLoad中调用addSegEvents。我收到错误无法识别的选择器发送到实例。这通常是由于缺少/额外结肠,但这不是这种情况,所以我不知道问题是什么?

1 个答案:

答案 0 :(得分:0)

目标必须是self,因为segToCurRoster()是在自身中声明而不是视图:

let currentWeekTapper = UITapGestureRecognizer(target: self, action:Selector("segToCurRoster"))