IOS8 Custom Uitabbar (problems with Uitabbarbutton overlap caused by using Poptoviewcontroller)

Source: Internet
Author: User

Recent work encountered a situation in which the tabbar in the iOS8 of their own definition overlap. It's the Uitabbarbutton that's been removed.

Toss for a long, do not know the reason lies.

Finally, scroll through the document. Said in IOS8 is allowed to dynamically add Tabbaritem. So, I guess that's not the reason. Then why is there no problem with iOS7?

Back to the chase. Since it is dynamically added. So follow Apple's usual style. This method must be called Viewwillautolayout.

Workaround:

-(void) viewwilllayoutsubviews{

[Super viewwilllayoutsubviews];

for (UIView *child in self . TabBar. Subviews) {

if ([Child iskindofclass:nsclassfromstring(@ "Uitabbarbutton")]) {

[Child Removefromsuperview];

}

}

}

-(void) Viewwillappear: (BOOL) animated

{

// Delete system auto-generated Uitabbarbutton

for (UIView *child in self . TabBar. Subviews) {

if ([Child iskindofclass: [uicontrol class]]) {

[Child Removefromsuperview];

}

}

[Super viewwillappear: animated];

}

IOS8 Custom Uitabbar (problems with Uitabbarbutton overlap caused by using Poptoviewcontroller)

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.