简体   繁体   中英

Scrolling on a table view with scrollEnabled=NO unhighlights the previously selected row

To reproduce, add a table view with scroll enabled set to NO. Then tap on one row and then scroll on the table view and you will see the previous selection becoming unhighlighted, until you lift your finger of the table view.

This seems to be the default behavior, is there a way to override it?

I think you can try to set your table view's UITableViewCellSelectionStyle like this

self.tableView.selectionStyle = UITableViewCellSelectionStyleNone;

This will disable the appearance of the cell highlight on touch-down before user has lifted his/her finger. Apple's document has mentioned this: tableView:willSelectRowAtIndexPath:

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