简体   繁体   中英

UITableViewCell setSelected:animated having no effect when animated

I've got a view controller on iPad with three UITableViews on it. They all have dataSource and delegate set to the VC. In tableView:didSelectRowAtIndexPath: in the VC, I do this:

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSLog(@"Cell: %@", cell);
[cell setSelected:NO animated:YES];

It logs the correct cell (non-nil), but the cell always stays selected until another cell in the same table is selected. If I pass NO for animated , it works fine. What's going on? Why won't the cell animate its deselection?

You can use [tableView deselectRowAtIndexPath:indexPath animated:YES]; to get the functionality you are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM