首页 > 其他 > 详细

UITableView tableFooterView autolayout自动计算高度

时间:2015-12-21 23:22:50      阅读:878      评论:0      收藏:0      [点我收藏+]
    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

UITableView tableFooterView autolayout自动计算高度

原文:http://www.cnblogs.com/binglin92/p/5051327.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!