简体   繁体   中英

is it necessary to Delegate UITabBarController to AppDelegate

I am a newbie summoned with lot of Questions. I am working with UITabBarController Window base application. Is it necessary to Delegate UITabBarController to AppDelegate. Its working fine for me with both delegating and not delegating.

i got some idea of delegate while working with UITableViewController. Please let me know what will happen with and without delgating UITabBarController.

Please suggest any Material or PDF or Book where i can get good idea with AppDelegate other than Apple docs.

You should read about the Model-View-Controller (MVC) paradigm and how delegates fit into it. A good source would be Apple's document on the matter, as well as most beginning iPhone Development Books. I would suggest this one , and a good starting place for MVC is here .

To answer your specific question, you want your AppDelegate to implement the UITabBarControllerDelegate protocol " when you want to augment the behavior of a tab bar. In particular, you can use it to determine whether specific tabs should be selected, to perform actions after a tab is selected, or to perform actions before or after the user customizes the order of the tabs. After implementing these methods in your custom object, you should then assign that object to the delegate property of the corresponding UITabBarController object." (From Apple's Class Document here .

In simplified terms, you use it when you want to do something custom/specific when a viewController is selected from the tab bar ( – tabBarController:didSelectViewController:) or will be ( – tabBarController:shouldSelectViewController:) . It can also be used to help with customizing the viewControllers showing on the tab bar if you have a need for more than allowed to be displayed at once (using a "More..." or whatever tab).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM