开发者

is it necessary to Delegate UITabBarController to AppDelegate

开发者 https://www.devze.com 2023-03-10 09:54 出处:网络
I am a newbie summoned with lot of Questions. I am working with UITabBarController Window base application. I开发者_C百科s it necessary to Delegate UITabBarController to AppDelegate. Its working fine

I am a newbie summoned with lot of Questions. I am working with UITabBarController Window base application. I开发者_C百科s 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).

0

精彩评论

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

关注公众号