UICollectionViewDelegate collectionView:willDisplayCell:forItemAtIndexPath is not called on focused cell when paging with custom layout
| Originator: | jordan.bondo | ||
| Number: | rdar://34284057 | Date Originated: | Sept 6, 2017 |
| Status: | Open | Resolved: | |
| Product: | tvOS + SDK | Product Version: | 11 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: I have a custom UICollectionViewLayout for displaying cells in a 2x2 grid in full screen. When the view first loads, UICollectionViewDelegate collectionView:willDisplayCell:forItemAtIndexPath is called for all 4 items in view. When paging to the next page of cells, the delegate method is NOT called for the focused cell under tvOS 11. Example: If I move to the top right cell (cell #1 in my custom layout) and move to the next cell horizontally (cell #4), the delegate method is called for all other cells except cell #4. If I move to the bottom right cell (cell #3) and move horizontally to the next cell (cell #6), the delegate method is not called for cell #6. This happens in both the simulator and on an actual Apple TV device. This is NOT the case in tvOS 10, only tvOS 11 Steps to Reproduce: In the attached sample project (CollectionViewTest) I have set up something very similar to my actual project - the custom layout code (CollectionViewLayout) is directly copied from my project. The currently focused cell has a white border drawn around it. Move from Cell #0 to Cell #1, then move horizontally to the next page to select Cell #4. Notice in the console output that "Will Display Cell #" is output for all cells #5, #6, and #7, but not for cell #4. When moving back to the previous cell (Cell #1) notice that "End Displaying Cell #" is again output for all cells except Cell #4. Expected Results: I expect the delegate method to be called for all cells. Actual Results: Delegate method is not called for all cells. Version/Build: tvOS 11 SDK (beta 6?) Configuration: macOS 10.12.6 Xcode 9 beta 6 Comment: Sept 29, 2017 Still present in tvOS 11 and tvOS 11.1 beta 1 using Xcode 9 and Xcode 9.1 beta 1
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!