abdollah
abdollah

Reputation: 29

adding favorite items of a table view in a new table view at ios swift

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

Answers (1)

tbilopavlovic
tbilopavlovic

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

Related Questions