Question

If I link an IBAction to multiple buttons, if multiple calls to this IBAction where done simultaneously would it cause interference or a crash. Will each one have to wait for the other, or is it concurrent?

Thanks

Was it helpful?

Solution

User interface events (button presses, etc.) are processed one-by-one by the main thread. Unless you are specifically calling your IBAction method from multiple threads, it will not be executed simultaneously. In other words, actions triggered by user interface events are run sequentially. Each action will complete before the next begins.

There is no need to write separate (but identical) methods for your buttons because the event-by-event processing of the main thread will ensure that the action method is called sequentially, once for each button press. If you write a separate action method for each button, those action methods will still be executed one at a time.

OTHER TIPS

They'll have to wait for each other to finish.

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