insertRowsAtIndexPaths causes (incorrect) cell layout of existing cells
| Originator: | rog.nolan | ||
| Number: | rdar://18349981 | Date Originated: | 16 Spet 2014 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 8.0 |
| Classification: | Reproducible: | Yes |
Summary:
Calling insertRowsAtIndexPaths on a tableview causes other cells in the tableview to layout - worse, the layout engine gets the layout wrong.
In the attached project, clicking on a cell cause new cells to be added in a section under the cell tapped. When those cells are added, cells in other sections layout and without adding or removing constraints) those cells generate layout warnings:
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7ffa92c4a880 V:[UILabel:0x7ffa92c4a6d0'Some other text'(21)]>",
"<NSLayoutConstraint:0x7ffa92c4b0e0 UILabel:0x7ffa92c48b60'TapMe and see what happen...'.top == UITableViewCellContentView:0x7ffa92c49940.topMargin + 6>",
"<NSLayoutConstraint:0x7ffa92c4b1d0 UILabel:0x7ffa92c4a6d0'Some other text'.bottom == UITableViewCellContentView:0x7ffa92c49940.bottomMargin>",
"<NSLayoutConstraint:0x7ffa92c4b220 V:[UILabel:0x7ffa92c48b60'TapMe and see what happen...']-(12)-[UILabel:0x7ffa92c4a6d0'Some other text']>",
"<NSLayoutConstraint:0x7ffa92f3fda0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7ffa92c49940(43.5)]>"
)
Steps to Reproduce:
call insertRowsAtIndexPaths in a section with a moderately complex auto layout cell.
Expected Results:
cells are added, things look OK.
Actual Results:
It looks awful. The console barfs.
Version:
6A1030
Notes:
a workaround would be nice :-)
Configuration:
Xcode 6.1B2
Attachments:
'AutoLayout.zip' 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!