Resolves an issue where a control with a background color on the cell is masked after setting Selectedbackgroundview

Source: Internet
Author: User

When you customize the selected background color to the cell, the control that has the background color on the cell will be obscured as if it disappears, and can be resolved in the following way

The selected background color of the cell I defined is green

    UIView *bgview = [[UIView alloc]initwithframe:programcell.bg_view.bounds];    Bgview.backgroundcolor = [Uicolor greencolor];        Cell.selectedbackgroundview = Bgview;

Unselected effects

Effect When selected

Use the following method to set the future

// implement the following two methods in a cell file // in the following two methods, set the label's background color -(void) setselected: (BOOL) selected animated: (bool) animated {    [ Super setselected:selected animated:animated];     // Configure The View for the selected state = graybgcolor;    }          -(void) sethighlighted: (BOOL) highlighted animated: (BOOL) animated{    [Super sethighlighted: Highlighted animated:animated];        = graybgcolor;     }

Resolves an issue where a control with a background color on the cell is obscured after setting Selectedbackgroundview

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.