Reputation: 29
i have an app that has a tab bar with two parts. one favorite that is empty at the begining and one for list of items shown in a table view and when i click on each another page opens and it shows some information. i want to add a button at information page and when i click on it adds the title to the favorite bar. how can i do this?
Upvotes: 1
Views: 864
Reputation: 1098
You can access to self.tabBarController and create some method to update title of controller at specified index.
Edit: call this on button pressed
var favoriteVC: FavoriteViewController = self.tabBarController.childViewControllers.objectAtIndex(0) // index of favorite controller
favoriteVC.addNewItemToMyItems("New item")
Upvotes: 1