IOS UITableViewCell return unchecked when push is selected

Source: Internet
Author: User

First I have a uitableviewcontroller, where each UITableViewCell click will push another viewcontroller, each time you click on the cell, the cell will be selected, When returned from the push Viewcontroller, the selected cell is automatically unchecked. Later, for some reason, I changed this uitableviewcontroller to Uiviewcontroller, and then there was a problem: each time I returned to TableView, the previously selected cell could not be automatically unchecked and was found to know:

Uitableviewcontroller has a Clearsselectiononviewwillappear property,

And when the Uitableviewcontroller is modified to Uiviewcontroller, this attribute naturally does not exist, so we have to manually add the unchecked function, the method is simple, in the Viewwillappear method to add:

[Self.tableview Deselectrowatindexpath:[self.tableview Indexpathforselectedrow] Animated:YES];

Or add in TableView didselected Indexpath proxy method

[Self.tableview Deselectrowatindexpath:indexpath Animated:yes];

IOS UITableViewCell return unchecked when push is selected

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.