systemLayoutSizeFittingSize: returns 0 height in iOS 8
| Originator: | jamie | ||
| Number: | rdar://17842251 | Date Originated: | July 29, 2014 |
| Status: | Duplicate | Resolved: | 2014.08.14 |
| Product: | iOS | Product Version: | 8 |
| Classification: | UI/Usability | Reproducible: | Always |
Summary: In the attached project, I have a UICollectionView whose cells have non-scrollable UITextView subviews. The UITextView is constrained using AutoLayout to its parent cell's edges using top, bottom, and leading space constraints. The UITextView also has a fix width constraint. I am calculating the cell's size at runtime using the systemLayoutSizeFittingSize: method on a temporarily allocated cell, loaded from a nib in the bundle (the same nib that is registered with the UICollectionView). That size is then returned in the UICollectionView's flow layout delegate method: collectionView:layout:sizeForItemAtIndexPath: This works in iOS 7, but not in iOS 8. In iOS 7 the systemLayoutSizeFittingSize: method returns a valid height for the temporary cell, but in iOS 8 it returns a height of 0. Steps to Reproduce: See description & attached project. 1. Create a UICollectionView and define its cells in a separate nib 2. Add a UITextView subview to the UICollectionViewCell nib 3. Add constraints in IB from the UITextView to its parent view for top, bottom, and leading spacing, and add a fixed width constraint to the UITextView 4. Calculate the cell's size at runtime using systemLayoutSizeFittingSize: Expected Results: Size returned by systemLayoutSizeFittingSize: should be non-zero (which is true in iOS 7 but not iOS 8) Actual Results: Size returned by systemLayoutSizeFittingSize: is zero in iOS 8 Version: iOS 8
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!
Resolved as duplicate of rdar://17962954 on 2014.08.18