Rubymotion 作为标签子视图的按钮不注册单击

Rubymotion 作为标签子视图的按钮不注册单击,rubymotion,Rubymotion,如果我创建一个按钮作为标签的子视图,当我单击它没有注册的按钮时,永远不会调用a_share方法。如何创建可以单击的子视图 button = UIButton.buttonWithType(UIButtonTypeRoundedRect) button.setFrame [[ 250, 536 ], [ 120, 120 ]] button.styleClass = 'browse_share' button.tag = 3 button.addTarget(self, action: "a_

如果我创建一个按钮作为标签的子视图,当我单击它没有注册的按钮时,永远不会调用a_share方法。如何创建可以单击的子视图

button =  UIButton.buttonWithType(UIButtonTypeRoundedRect)
button.setFrame [[ 250, 536 ], [ 120, 120 ]]
button.styleClass = 'browse_share'
button.tag = 3 
button.addTarget(self, action: "a_share:",
                    forControlEvents:UIControlEventTouchUpInside)
label.addSubview button


确保打开标签的用户交互,否则它不会传递任何点击/手势:

label.userInteractionEnabled = true

谢谢,迪伦,成功了。我的脑袋还在想着电话api。社区一直很好。
label.userInteractionEnabled = true