TableView a row is selected, the selected color is not displayed .... N Solutions to

Source: Internet
Author: User


TableView Select a row, do not display the selected color, do not set the TableView allowsselection to No, which may cause tableview can not respond to the click action. A reasonable solution is to:

directly at the time of creating the cell:

Cell.selectionstyle = Uitableviewcellselectionstylenone;

Or you can create a cell through Xib . It is also possible to write it in the nib of xib: (Same principle)

-(void) awakefromnib {//Cancel cell check style Self.selectionstyle = Uitableviewcellselectionstylenone;}

Is there anything else? Try this callback function again to cancel

-(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath {[TableView Deselectrowatindexpath:indexpath Animated:yes]; No off animation effect}

(But this will be a flash, but it's also a way to scatter)

And, of course, when the cell was created, you were creating a canvas to cover it up, but was it easy for you to make sure you created it yourself?

Uncheck color UIView *backview = [[UIView alloc] initWithFrame:cell.frame];  Cell.selectedbackgroundview = Backview; Cell.selectedBackgroundView.backgroundColor = [Uicolor Clearcolor];


TableView a row is selected, the selected color is not displayed .... N Solutions to

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.