本文主要是介绍iphonewax下用lua代码addTarget_action_forControlEvents给UIButton添加事件程序crash解决办法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
创建button代码的地方要初始化button的类型 如下:
local play = UIButton:buttonWithType(UIButtonTypeCustom)play:setFrame(CGRect(p[1], p[2], size.width, size.height))play:setBackgroundImage_forState(imgplay, 0)play:addTarget_action_forControlEvents(self,"onDeleteIconClick:",UIControlEventTouchUpInside)
事件处理代码如下:
function onDeleteIconClick(self, sender) puts(" clicked------ ")
end
console输出截图
另外:凭个人经验(不一定正确)wax框架下的lua函数定义的时候函数签名不在特定时候不能使用下划线“_”.
这篇关于iphonewax下用lua代码addTarget_action_forControlEvents给UIButton添加事件程序crash解决办法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!