UITableViewCell content view width differs depending on whether cell has been through a table view
| Originator: | amorya | ||
| Number: | rdar://19242003 | Date Originated: | 13-Dec-2014 12:22 AM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 8.1 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: When I create a UITableViewCell myself in code, settings its frame manually to 320px wide, its accessory type to detail disclosure, calling layoutIfNeeded, then asking it for its content view frame, the result is 294 pt. When that same table view cell gets displayed on screen in a 320pt wide table view, and I again check its content view width, the result is 287pt. These results should not differ. It is very useful to create a table view cell and ask it for sizes in code — creating a prototype cell and populating it with data is a common way to calculate cell height. Steps to Reproduce: 1. Run the attached Xcode project on the iPhone 5 simulator. 2. Click Reload once. 3. Look in the Xcode console. Expected Results: 1. Content view width: 287.000000 2. Content view width: 287.000000 Actual Results: 1. Content view width: 294.000000 2. Content view width: 287.000000 Notes: Line 1 of the log is the size calculated before the cell is handed to the table view. Line 2 is calculated when a cell is being reused, i.e. it has already been given to the table view.
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!
Sample project
Sample project here: https://dl.dropboxusercontent.com/u/18362750/TableTest.zip