错误提示
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DBFM.ViewController onPlay]: unrecognized selector sent to instance 0x7fe3586a3820'
相关代码
btnPlay.addTarget(self, action: "onPlay", forControlEvents: UIControlEvents.TouchUpInside)
解决方法
(带参数的方法应该加上冒号: )
btnPlay.addTarget(self, action: "onPlay:", forControlEvents: UIControlEvents.TouchUpInside)
本文介绍了一个关于Swift UI中按钮响应的问题,具体表现为按钮触发了未被实例识别的动作,导致应用崩溃。文章提供了错误提示及相关的代码片段,并给出了正确的设置按钮响应方法的方式。
2214

被折叠的 条评论
为什么被折叠?



