I created two classes. In each class there are UIButton and the related event. We can click on this button and the condition will change. If we click on the button in the same class and the second class status button should change. How to realize it there is an assumption to make it through the delegate, but I don’t quite understand how.
The result should be something like the image if one of the classes button changes its status as at 1 in the other class this state changed to zero
I solved this problem as follows.
I create an Objective-C protocol which contain one required method
Next I create class A – this class contain button which will be paired with another class (Class B)
In implementation file I added delegate method and reaction method
Next I create class B – this class contain button which will be paired with another class (Class A)
In implementation file I added delegate method and reaction method
Next i create instance class A and class B and bind them
When I tap on the button in one class in other class we call delegate method and change state for view.