Table view cell stays selected when deselected off-screen
| Originator: | and.mikhaylov | ||
| Number: | rdar://22151209 | Date Originated: | 05-Aug-2015 03:55 PM |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 8.4 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: I have a standard table cell with text field inside. I dismiss keyboard and deselect table cell when user taps on “Done” button in input accessory view. For some reason if I scroll table view all the way down to make selected cell go off-screen, then if I dismiss the keyboard, the first cell remains visually selected even though indexPathForSelectedRow reports nil. Steps to Reproduce: 1. Run test project in iPhone 5 sim. 2. Select first row in table view. 3. Scroll table view to the bottom. 4. Tap “Done” button above keyboard. Expected Results: Cell being deselected after I call deselectRowAtIndexPath regardless whether cell is on or off screen. Actual Results: Cell remains visually selected, and table view reports nil for indexPathForSelectedRow. Regression: 1. The bug goes away if I swap endEditing and deselectRowAtIndexPath. E.g. the bug is reproducible when deselectRowAtIndexPath goes first. 2. Seems like an edge case because changing number of rows in table view makes bug go away. Notes: I hosted the sample project at https://github.com/pronebird/TableViewSelectionBugIOS8. I tested the same project on iOS 9 with Xcode 7.0 beta 4 and I can confirm it is reproducible there too.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!