【发布时间】:2016-01-13 09:35:48
【问题描述】:
我不知道我的代码有什么问题。当我单击按钮时,方法不执行。这是我的代码:
configView: function() {
var button = UIButton.buttonWithType(0);
button.setFrame({x:10,y:10,width:100,height:100});
button.setTitle_forState('touch me',0);
self.view().addSubView(button);
button.setBackgroundColor(UIColor.redColor());
button.setCenter(self.view().center());
button.addTarget_action_forControlEvents(self,'touch',0);
},
touch:function(){
console.log('touchme');
}
这可能是问题吗?
button.addTarget_action_forControlEvents(self,'touch',0)
【问题讨论】:
-
对不起,在我的代码中,
UIButtonTypeCustom UIControlStateNormalis 0 like thisvar button = UIButton.buttonWithType(0); button.setTitle_forState('touch me',0); -
你的评论是什么意思?
-
@Davesexcel 我给你看的代码很麻烦,对不起
标签: javascript ios objective-c