Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the event that switch tab menu on iphone

I'm trying to figure out how to catch the event that controls the switch tabs on the UITabBarController. How could I accomplish this?

like image 702
Yan Avatar asked Jan 11 '10 13:01

Yan


People also ask

Where is tab bar in IOS?

The tab bar always appears across the bottom edge of the screen. A UITabBar object contains one or more UITabBarItem objects. However, we can customize the appearance of the Tab Bar by changing its background color, image, or tint color according to the interface.

What is tab bar on iPhone?

With the Landscape Tab Bar feature enabled, Safari automatically displays the open tabs along the top of the screen when you use your iPhone in landscape orientation. Now, to switch between open tabs, all you need to do is swipe through them horizontally or tap the tab you wish to use.


1 Answers

Implement UITabBarControllerDelegate e.g. in your app delegate's applicationDidFinishLaunching

- (void)applicationDidFinishLaunching:(UIApplication *)application {     tabBarController.delegate = self;     [window addSubview:tabBarController.view]; } 

Then implement either:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;  - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController; 

The first method is called before the view switch and gives you a chance to 'veto' the view switch by returning NO

The second method is called after the view switch has taken place

like image 144
cidered Avatar answered Sep 19 '22 05:09

cidered