Aneesha Nisha
Aneesha Nisha

Reputation: 11

Button Click in one viewController get to know in another ViewController

I have two UIviewControllers in storyboad. Eg:UIViewControler-A and UIViewController-B.

I have a Boolean variable in the ViewController A and its default value is NO.

There is a close button in the UIViewContoller B,( to dismiss the view controller).

My question is when I click the close button in the viewContoller B, The boolean Value of ViewContoller A should become YES. Please help.

Upvotes: 0

Views: 66

Answers (1)

crgt
crgt

Reputation: 1482

You could either set view controller A as a delegate of view controller B and create/call a delegate method when the button in view controller B is tapped, or you could post a notification when the button in view controller B is tapped and add an observer in view controller A that calls a method to update your boolean in view controller A.

Upvotes: 2

Related Questions