-[UICollectionView reloadSections:] does not remove displaying cells from UICollectionView
| Originator: | crazygemini.Lee | ||
| Number: | rdar://21473823 | Date Originated: | |
| Status: | Close | Resolved: | |
| Product: | iOS | Product Version: | |
| Classification: | Reproducible: |
Summary: The cells displayed in `UICollectionView` are not removed from it after calling `-[UICollectionView reloadSections:]`. Steps to Reproduce: Use this gist to reproduce this bug: https://gist.github.com/crazytonyli/2b340ca9b49143366938 1. Put the `ViewController.m` file into an iOS Xcode project. 2. Create an instance of `ViewController` and present it. 3. Run the iOS demo project, present `ViewController`. 3. Checkout the console log. 4. After the 'reload' log is shown, use Xcode's Debug View Hierarchy tool to checkout UICollectionView's subviews. Expected Results: The cells count should be same before and after `reloadSections` message is sent. Number of cells in `UICollectionView` instance should not be greater than the number of items in section 0. Actual Results: If run the demo project in iPhone 6 Simulator, the console output will be: ``` cells: 4 reload cells: 8 ``` Use Debug View Hierarchy tool to checkout `UICollectionView`'s subviews, we will see 8 cells, but we should only have 5 items for section 0. Version: iOS 8 Notes: Configuration: Tested on iPhone 6 Simulator Attachments: 'Screen Shot 2015-06-20 at 7.43.20 PM.png' was successfully uploaded.
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!
Collection view does not always remove cells from the superview when they are reused - they become hidden instead. This is correct behavior designed for maximum performance.