UITabBarController Sequence

//UITabBarController Sequence

UITabBarController Sequence

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.

By |2015-12-12T13:10:33+00:00Donnerstag, Februar 17th, 2011|Development|0 Comments

About the Author:

Leave A Comment

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.