NSButton多次点击 [英] NSButton Multiple clicks
本文介绍了NSButton多次点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有按钮被点击时要改变我的观点的IBAction为。我如何处理,例如多次点击,如果我按一下按钮第二次导致另一个动作?
I have an IBAction of when the button is clicked to change my view. How can I handle multiple clicks for example if I click the button a second time to cause another action?
或者我需要删除按钮被点击后,然后创建在其位置一个新的?如果是的话我怎么处理click事件?
Or do I need to delete the button after it has been clicked and then create a new one in its place? If so how do I handle the click event?
推荐答案
您可以检查MouseDown事件的的clickCount
:
You can check the clickCount
of the mouseDown event:
if ([event clickCount] > 1)
{
// ... do double-click action
}
else
{
// ... do single-click action
}
这篇关于NSButton多次点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文