When using a prototype UICollectionViewCell, its size as specified by the UICollectionViewDelegate isn't set in its bounds.
Originator: | markos | ||
Number: | rdar://24629399 | Date Originated: | 12-Feb-2016 05:17 PM |
Status: | Open | Resolved: | |
Product: | iOS | Product Version: | 8.4.1, 9.2.1 |
Classification: | Other Bug | Reproducible: | Always |
Summary: The prototype cell of a UICollectionView as specified in a storyboard does not take into consideration the CGSize retuned by a UICollectionViewDelegate at collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize Steps to Reproduce: 1. Create a Single View Application 2. Open the Main.storyboard 3. Drag a UICollectionView 4. Set a reuse identifier for the single UICollectionViewCell 5. Create a subclass of UICollectionViewCell, implement required init(coder:) and set it as the class for the prototype cell 6. Have the provided ViewController implement UICollectionViewDelegate, UICollectionViewDataSource to return 1 cell with the same reuse identifier 7. Specify a sizeForItemAtIndexPath other than the default cell size in the prototype cell. Expected Results: When init(coder:) is called, the cell's bounds' size to have the value specified in sizeForItemAtIndexPath Actual Results: The cell's bounds' size is set to the prototype's cell size Version: iOS 8.4 SDK, iOS 9.2 SDK, Xcode 7.2.0, Xcode 7.2.1 Notes: Workaround, use UICollectionView.registerClass(:forCellWithReuseIdentifier:) to register the cell instead. Configuration: iPhone 4S, iOS 9.2.1 | iPhone 5, iOS 8.4.1 | Xcode 7.2. Simulator (iPhone 4S, iPhone 6 Plus) Attachments: 'PrototypeCellDefect.zip' was successfully uploaded. https://www.dropbox.com/s/a9lpnlhz1foy987/PrototypeCellDefect.zip?dl=0
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!