First, delete the system from the Tabbar
In development, we often need to define our own Tabbar, use custom Tabbar, return or jump encounter Tabbar ghosting phenomenon, this time we need to the system Tabbar
The proxy method for implementing Navigationcontroller
-(void) Navigationcontroller: (Uinavigationcontroller *) Navigationcontroller Willshowviewcontroller: (Uiviewcontroller *) Viewcontroller animated: (BOOL) animated
{
// Deletes the system Tabbarbutton for
(UIView *tabbar in self.tabBarController.tabBar.subviews) {
if ([Tabbar iskindofclass : Nsclassfromstring (@ "Uitabbarbutton")]) {
[Tabbar Removefromsuperview];}}}
Second, set the custom Tabbar the selected effect
maintabbarviewcontroller * Tabbarcontroller = (Maintabbarviewcontroller *)
Self.navigationController.tabBarController;
Tabbarcontroller.selectedindex = 0;
tabBarController.customTabBar.selectedButton.selected = NO; For (UIView *child into tabBarController.customTabBar.subviews) {if ([Child Iskindofclass:[maintabbarbutton class]] {if (Child.tag = 0) {TabBarController.customTabBar.selectedButton = (Maintabbarbutton *)
Child
tabBarController.customTabBar.selectedButton.selected = YES; }
}
}