Self-customizing Tabbar click on different pages will be multiple simultaneous lighting situation

Source: Internet
Author: User

Let me explain this bug first:

I customize the Tabbar when using 4 buttons instead of the button to set the point and not in the point of the picture, and then switch between the different pages should be only one point in the state, but I will appear in many or even all points in the case, engaged for a half a day to know where the problem.

for (int i=0; i<4; i++) {

// Write the button 's direct parent control BOTTOMBG go to the tag again, or there will be a problem .

UIButton * button = (UIButton *) [bottombgviewwithtag:+i];

UIButton * Button = (UIButton *) [Self.view viewwithtag:100+i];


button. selected =NO;

}

Btn. selected =YES;

Self . SelectedIndex = btn. Tag-+;


As shown in the code above, the problem is to find the button according to the tag value when the original I was looking for from Self.view, and button on the BOTTOMBG,BOTTOMBG on Self.view, indirectly find I think there is no problem, but really not.

So it is best to find the control by tag value directly from the parent class control, there is no problem. Specifically why, too specific reasons I do not understand, who knows can guide ~


Self-customizing Tabbar click on different pages will be multiple simultaneous lighting situation

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.