The background color is not changed when the uitableviewcell in the editing status responds to the click event.

Source: Internet
Author: User

In the editing status of tableview: [self. tableview setediting: Yes animated: No], the cell responds to the click event without changing the color, but can respond to the event as follows:


1. In cellforrowatindexpath, add a background view to the new cell: (set the background to white when the cell is selected)

Uiview * aview = [[uiview alloc] initwithframe: cell. Frame] autorelease];

Aview. backgroundcolor = [uicolor whitecolor];

Cell. selectedbackgroundview = aview;


2. Add the following to the response Click Event didselectrowatindexpath:Code:( Set the contentview background on the cell to white when selected, and set the textlabel on the contentview to white when selected)

[Self. tableview cellforrowatindexpath: indexpath]. textlabel. backgroundcolor = [uicolor whitecolor];

[[Self. tableview cellforrowatindexpath: indexpath]. contentview setbackgroundcolor: [uicolor whitecolor];



Therefore, the cell contains contentview, And the contentview contains textlabel.

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.