I get this error from my custom UITableViewHeaderFooterView:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. WYBDetailHeaderView implementation of -layoutSubviews needs to call super.'
I have subclassed UITableViewHeaderFooterViewand created an XIB file that I upload using registerNib:forHeaderFooterViewReuseIdentifier:to mine UITableView.
Since there is no IB UITableViewHeaderFooterView, I followed advice in other posts and simply used UIView( UITableViewHeaderFooterView in InterfaceBuilder ; UITableViewHeaderFooterView with IB ).
My custom one UITableViewHeaderFooterViewuses AutoLayout and includes two multi-line ones UILabel, and I assume that the problem is that these subtasks are on the actual UITableViewHeaderFooterView, and not .contentView. However, I do not know how to do this with IB.
This is my implementation layoutSubviews(I tried several combinations without success). I even get an error when I completely remove this function:
- (void)layoutSubviews
{
[super layoutSubviews];
self.titleLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.titleLabel.frame);
self.subtitleLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.subtitleLabel.frame);
}
How should I do it?
source
share