samedi 28 février 2015

Swift: Returning to original view of tab bar controller within code when that selectedIndex is already selected

I have a tab bar controller with the first view (index 0) having a segue to another view (but stays on index 0 of the tab bar). In this segued view, I have a "Back" button which I want to return to the original view at index 0 when selected. However, when I use:


self.tabBarController?.selectedIndex = 0


I remain on the current segued view. I know it should work because if I change the index to 1 or 2 then it switches to the other views. Also, from the segued view, if I click on the tab bar icon for index 0 (which is the one already highlighted/selected) it does exactly what I want and brings me back to the original view from the segued view. So how do I get my button to do exactly what the tab bar does when I select the already highlighted/selected index?




Aucun commentaire:

Enregistrer un commentaire