To change the UITabBarController sequence UITabBarDelegate Protocol offers a way to reorganize the sequence of the view controllers in a UITabBar by going to the more navigation controller, push Edit and drag the items on the place you find more appropriate.
If you haven’t noticed that, have a look to the iPod app on your iPhone.
If you have more than 5 it adds automatically a more navigation controller so that the size of a single UITabBarItem is not smaller than 64px.
But how to persist the sequence and let the app start with the view controller when you left off the last time.
Here is what the code does.
1. store an array with indices in NSUserDefaults
2. the last item in the array holds the tag number of the view controller or NSNotFound if you where in the more navigation controller when you left the app.
The code counts on the fact you have numbered the view controllers tags consecutively starting with 0.
Privacy & Cookies Policy
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.