Tabbar with IOS removal system

Source: Internet
Author: User

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; }
        }
    }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.