开发者

Saving view configuration changes in my Tab Bar Controller based application

开发者 https://www.devze.com 2023-01-11 03:21 出处:网络
I have an application that uses a tab bar controller. The tab bar controller manages 11 views in total so there are 4 views available on the first 4 tab bar buttons and the rest are available via the

I have an application that uses a tab bar controller.

The tab bar controller manages 11 views in total so there are 4 views available on the first 4 tab bar buttons and the rest are available via the 5th button named "More".

I have a couple of questions here...

Firstly...

Can i rename the "More" button?

Secondly...

When i press "More" and then press the "Edit" button on the navigation bar at the top of the view to go into the "Configure" mode and then re-arrange some of the additional views so they are now on the first 4 buttons (replacing the original 4 views), i then press "Done" and begin using my App again. However when i close the app and reopen it my configuration changes have gone and the App is back to its 开发者_StackOverfloworiginal state with the same 4 views on the first 4 buttons as was there when the app was originally installed!

(Just like the Music App)

The second question is therefore...

How do i make the new configuration save in my app so the next time the app is opened it is configured the new way?


I don't think you can rename the More button.

As to the second question: your UITabBarControllerDelegate will get messages at

-tabBarController:didEndCustomizingViewControllers:changed:

You can catch the ordering change here, and then set UITabBarController.viewControllers to the proper order in -viewDidLoad.


OK so i went away, did some more searching and reading and found the following great tutorial

http://www.raddonline.com/blogs/geek-journal/iphone-sdk-uitabbarcontroller-how-to-save-user-customized-tab-order/

This helped a lot (in fact it gave the solution with insights) so i thought i should add it here for others who do not yet know how to do it.

0

精彩评论

暂无评论...
验证码 换一张
取 消