OGeek|极客世界-中国程序员成长平台

标题: Ios Swift 2 为选择器传递第二个参数 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 17:01
标题: Ios Swift 2 为选择器传递第二个参数

我正在尝试在调用选择器时添加第二个参数,谁能告诉我如何准确地做到这一点

我试过了:

let BtnVar = UIButton(title: "TrlTxt",
                       style: UIBarButtonItemStyle.Plain,
                       target: self,
                       action: #selector(self.NavRitBtnKlk(_:, Nam2Var)))

func NavLitBtnKlk(sender: UIButton, Nam1PsgVar: AnyObject)
{
    /* CodTdo */
    print("Clicked")
}



Best Answer-推荐答案


选择器应该是

#selector(self.NavRitBtnKlk(_:Nam1PsgVar)

关于Ios Swift 2 为选择器传递第二个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37993742/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4