NSButton Multiple clicks

只谈情不闲聊 提交于 2019-12-10 11:12:02

问题


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?

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?


回答1:


You can check the clickCount of the mouseDown event:

if ([event clickCount] > 1)
{
    // ... do double-click action
}
else
{
    // ... do single-click action
}


来源:https://stackoverflow.com/questions/8997522/nsbutton-multiple-clicks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!