I have strange behavior with UITableView. I installed UIViewControllerwith UITableView. UITableViewIt contains tableHeaderView, tableFooterViewfooter section, and a pair of UITableViewCelldynamic heights.
The problem is that it tableFooterViewappears somewhere in the middle of the table (hangs over the cell), and does not align at the bottom of the contents of the table. Apparently, the table property contentSizealso returns the wrong size of the content (in particular, the height).
However, the footer of the user section is displayed in the right place (and below the actual one tableFooterView- which is in the middle of the table).
Any ideas what is going on?
Note. My custom tabular view (with dynamic bit height using automatic layouts) shows "Ambiguous layout: 2 vertical representations are ambiguous." warning but correct resizing at runtime.
Setting up the table is quite simple:
self.myTableView.tableHeaderView = self.myTableHeaderView;
self.mainTableView.tableFooterView = self.myTableFooterView;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return [self heightForCellAtIndexPath:indexPath];
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
return [MyCustomCell defaultHeight];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
if (section == 0) {
return self.mySectionFooterView;
}
return [UIView new];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
if (section == 0) {
return [self heightForSectionFooterView];
}
return 0.01f;
}
source
share