In iOS8, automatically changeable table view tables have been introduced (WSDC Session 226 What's New in Table and Collection Views). In my project, I am trying to implement the old fixed row height behavior. In addition, for me the most important thing is to set the default frame cell.contentViewwith fields on the left and right. So, I change the property cell.contentView.frame, and right after that the method is called -[cell setNeedsLayout], and it leads to the cell getting stuck in an infinite loop layoutSubviews.
Steps to play:
-(void)viewDidLoad {
[super viewDidLoad];
self.tableView.estimatedRowHeight = 0;
self.tableView.rowHeight = 44;
}
3. Drop the custom cell as a table in the storyboard,
Add any subordination to the user cell:
,
Cell subclass and change contentView.framein layoutSubviews,
Create and run.
Result: The simulator ends on a black screen stuck in an endless spy layout.
Expected Result: The simulator displays a view of a table with a cell contentViewthat has its own frame.
Comment: When debugging a bit, I found that an infinite loop can be avoided if the cell does not have any custom subzones dropped on it. Thus, it seems that the error will appear after the following conditions are met:
self.tableView.estimatedRowHeight = 0; self.tableView.rowHeight = 44;cell.contentView.frame = CGRectMake(...)cell have custom subviews dropped on it in xib or storyboard
Apple " " iOS8, , iOS8 - , ?