简体   繁体   中英

Manage interactions between sibling view controllers inside of a container view controller

I am building a container view controller that would host > 2 child view controllers.

Each of these child view controllers needs to interact with the other view controllers. eg one of the child view controllers needs to refresh content in the other view controller when the refresh button is pressed inside of it.

What is the best way to manage these interactions?

I was thinking of having a delegate back from each of the child view controllers and having the container view controller pass this to the relevant child view controller.

A delegate is certainly a good way to do it. Another is to use NSNotificationCenter , which completely disassociates the controllers from dependencies on one another.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM