IOS Custom Tabbar tips on push issues

Source: Internet
Author: User

at the time of development, I believe that everyone has used tabbar, today I write the project time also used to Tabbar Jinzhao a series of problems on the


Requirement: The main frame of my project is Tabbar, but the tabbar of the system is not beautiful

So I customized my tabbar, created a class, inherited from Uitabbarcontroller, in this class I will system native Tabbar hidden, wrote such a sentence,

Self.tabbar.hidden=yes;

Then there is a series of code that we can not write in the cooked, introduce the Viewcontroller header file, and then instantiate, the Viewcontroller are made with the navigation, put in an array, in the array to assign to Tabbar like this

    Trendfashionviewcontroller *trend=[[trendfashionviewcontroller alloc] init];//uinavigationcontroller *trendNa=[[UI    Navigationcontroller alloc] initwithrootviewcontroller:trend];//trendna.navigationbarhidden=yes; Liferesourceviewcontroller *left=[[liferesourceviewcontroller alloc] init];//uinavigationcontroller *leftNa=[[    Uinavigationcontroller alloc] initwithrootviewcontroller:left];//leftna.navigationbarhidden=yes; Maintainmanageviewcontroller *main=[[maintainmanageviewcontroller alloc] init];//uinavigationcontroller *mainNa=[[    Uinavigationcontroller alloc] initwithrootviewcontroller:main];//mainna.navigationbarhidden=yes; Perfectselfphotoviewcontroller *per=[[perfectselfphotoviewcontroller alloc] init];//UINavigationController *perNa=    [[Uinavigationcontroller alloc] initwithrootviewcontroller:per];//perna.navigationbarhidden=yes; Microsoundviewcontroller *mir=[[microsoundviewcontroller alloc] init];//uinavigationcontroller *mirNa=[[Uinavigationcontroller alloc] Initwithrootviewcontroller:mir];    Mirna.navigationbarhidden=yes;    Nsarray *arr=[nsarray Arraywithobjects:trend,left,main,per,mir, nil]; Self.viewcontrollers=arr;

The next thing is to customize the Tabbar, achieve the desired effect, and then I'll make this custom tabbarcontroller in appdelegate root, but when I want to push to another page, the problem comes with the original command

self. Navigationcontroller. hidesbottombarwhenpushed=YES;


at All, the reason is that my tabbar is my custom, so this command naturally does not take effect, I also on the Internet to check a lot of ways, some said push when the tabbar removed from the screen back when the back, and so on, Test did not try to come out, and then I think, simply in the appdelegate without a custom tabbar when the root, with Navigationcontroller when the root, and then the custom Tabbar class inside the Viewcontroller navigation are removed, No, it's OK, so when I want to push, there's nothing to worry about, direct push


Mytabbarcontroller *mytabbar=[[mytabbarcontroller alloc] init];        Uinavigationcontroller *na=[[uinavigationcontroller alloc] initwithrootviewcontroller:mytabbar];        Na.navigationbarhidden=yes;              Self.window.rootviewcontroller=na;
As the code, it is very clever to solve the push after the Tabbar does not disappear, because I want to customize the navigation bar so I set Navigationbarhidden to Yes;


If you're having trouble with other ways to hide your custom Tabbar, try this method.

Of course, if you guys have a good way, welcome to share it, (*^__^*) hehe ...





IOS Custom Tabbar tips on push issues

Related Article

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.