在我UIView,我有一个UIButton显示.
在同一个UIView类中,我有一个方法,我想按下按钮时执行.
当一切都以编程方式完成,而不使用Interface Builder时,如何将两者链接在一起?
Dan*_*Dan 10
使用UIButton addTarget:action:forControlEvents:message指定UIControlEventTouchUpInside事件的选择器.
[myButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
Run Code Online (Sandbox Code Playgroud)