I have a short question, let’s assume I have a TabBarController with 3 Tabs (tab1,tab2,tab3) now how do i pass data between those if none of those know of each other. Let’s say i click on tab1 and then on tab2 how does tab2 know of tab1. I’ve tried it with delegation, making tab2 the delegate of tab1 but then i realized, i can’t set tab1 delegate, because tab1 doesn’t know of tab2 yet. Is it even possible to pass data directly between these Tabs without using the AppDelegate or CoreData?
Share
You can subclass the tabBarController class and give it referencing outlets for all three tabs.
You then create and synthesize 2 tab Bar Item properties in each of the (subclassed) Tab Bar Item and in the ViewDidLoad method of the tabBarController you set each tab bar item property to be one of the three referencing outlets.