This comment has been minimized.
This comment has been minimized.
@benpackard Yep! Especially if you want the |
This comment has been minimized.
This comment has been minimized.
@smileyborg Thanks! Somewhat confusing given the docs and sometimes the mix up between section headers vs table header view, so I appreciate you confirming. |
This comment has been minimized.
This comment has been minimized.
Hi, could you explain the context of this piece of code if you have time? Is it supposed to be called in a In my case, I am using a container for my headerView and I add the container to the For a little bit of context on my side: // This is a setup function in my viewDidLoad
UIView *headerContainerView = [UIView new];
self.headerView = [CustomView new];
[headerContainerView addSubview:self.headerView];
[self.headerView updateWithTitle:@"Test" andDescription:@"Test description"];
[self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(headerContainerView.mas_top).offset(16);
make.leading.equalTo(headerContainerView.mas_leading).offset(16);
make.trailing.equalTo(headerContainerView.mas_trailing).offset(-16);
make.bottom.equalTo(headerContainerView.mas_bottom).offset(-16);
}];
headerContainerView.transform = self.tableView.transform; // It is legacy code, so the tableview right now is inverted. it should not impact the way we show the tableview.
self.tableView.tableFooterView = headerContainerView;
// The following code was executed before for `tableHeaderView` in the rest of the app, and it was working like a charm. But since I dig a little bit about `tableHeaderViews` apparently set `translatesAutoresizingMaskIntoConstraints ` to `NO` might cause a problem, without even applying any constraints.
// [headerContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.centerX.equalTo(self.tableView.mas_centerX);
// make.width.equalTo(self.tableView.mas_width);
// make.top.equalTo(self.tableView.mas_top);
// }]; And then, I have my current // It is clearly a workaround for this auto layout issues with tableHeaderView
[super viewDidLayoutSubviews];
if (self.tableView.tableFooterView == nil) {
return;
}
UIView *tableFooterView = self.tableView.tableFooterView;
CGFloat footerHeight = [tableFooterView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
CGRect footerFrame = tableFooterView.frame;
if (footerHeight != footerFrame.size.height) {
footerFrame.size.height = footerHeight;
tableFooterView.frame = footerFrame;
[self.tableView setTableFooterView:tableFooterView];
} Thank you for your further help and time. |
This comment has been minimized.
Should a
tableHeaderView
really be a subclass ofUITableViewHeaderFooterView
? The docs say that theUITableViewHeaderFooterView
is "a reusable view that you place at the top or bottom of a table section to display additional information for that section." (my bold.) It doesn't mentiontableHeaderView
ortableFooterView
.