Cocoa forControlEvents:WHATGOESHERE [英] Cocoa forControlEvents:WHATGOESHERE

查看:150
本文介绍了Cocoa forControlEvents:WHATGOESHERE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Cocoa / Objective-C中,如果我以编程方式创建了一个按钮,那么我为我的控制事件输入什么?

In Cocoa/Objective-C if I have created a button programmatically, what do I put in for my control event?

[btnMakeChar addTarget:self action:@selector(makeChar:) forControlEvents:WHAT GOES HERE?];

在iOS中,您可以这样编写:forControlEvents:UIControlEventTouchUpInside

In iOS you can write it like so forControlEvents: UIControlEventTouchUpInside

我找不到任何东西,只显示可可,而不是可可。

I can't find anything to show what I would use for just cocoa, not cocoa touch

推荐答案

'm不确定我是否正确理解你,但如果你正在编程一个Mac,

I'm not sure if I understand you correctly, but if you're programming a Mac,

[theHappyButton setTarget:self];
[theHappyButton setAction:@selector(doStuff)];

它是两个单独的行,而不是iPhone上的一行代码。

it is two separate lines, rather than the one combined line of code on an iPhone.

我希望这是你之后的

在doco中找到它:在10.6 doco不是iOS),并搜索setAction:。你会在NSControl类参考中看到它。 NSButton当然是NSControl的子类。

To find it in the doco: choose on the 10.6 doco (not iOS) and search on "setAction:". You'll see it in NSControl Class Reference. NSButton is of course a subclass of NSControl.

这篇关于Cocoa forControlEvents:WHATGOESHERE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆