UIView *tableFooter = [UIView new];
self.tableView.tableFooterView = tableFooter;
UILabel *footerLabel = [UILabel new];
footerLabel.numberOfLines = 0;
footerLabel.backgroundColor = [UIColor redColor];
[tableFooter addSubview:footerLabel];
//UITableView 不能给 tableFooterView添加约束,但可给其子view添加约束
[footerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(tableFooter).mas_offset([NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(10, 10, 10, 10)]);
}];
footerLabel.preferredMaxLayoutWidth = CGRectGetWidth([UIScreen mainScreen].bounds) - 20;
footerLabel.text = @"[footerLabel mas_makeConstraints:^(MASConstraintMaker *make) {\
make.edges.mas_equalTo(tableFooter).mas_offset([NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(10, 10, 10, 10)]);\
}];";
//计算tableFooterView的size
CGSize size = [tableFooter systemLayoutSizeFittingSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, 1000)];
tableFooter.frame = CGRectMake(0, 0, size.width, size.height);
self.tableView.tableFooterView = tableFooter;
http://prod.lists.apple.com/archives/cocoa-dev/2014/Jun/msg00131.html