Question

I have NSButton created on interface builder for this app of mine.

When this button is pressed the app starts to render an image. At this time the button's label change to PRESS TO CANCEL RENDER.

The render happens on a second thread but because the app is busy, it may take one or two seconds for the render to stop when that button is clicked. At this time the user may get impatient and click repeatedly on the button, making the app stop, start, stop, start, etc., the render.

Even not responding to the action immediately, the app stores all clicks on that button and processes them when possible.

Is there a way to set the app in a way that when it starts rendering it will accept just one click on that button (to stop the render) and ignore all others until the render finally stops?

Was it helpful?

Solution

You can use

[_yourButtonOutlet setEnable:NO];

and then enable it when the rendering has stopped completely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top