문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top