首页 > 其他 > 详细

UITableView的子控件高度不确定处理

时间:2016-05-07 12:41:47      阅读:161      评论:0      收藏:0      [点我收藏+]

比如,tableView的tableFootView的控件数量是根据网络请求的数据而定的。那么tableView并不能准确的设置其contentSize.处理方法:

在tableFootView的类中:

// 设置footer的高度 == 最后一个按钮的bottom(最大Y值)
    self.xmg_height = self.subviews.lastObject.bottom;
    
    // 设置tableView的contentSize
    UITableView *tableView = (UITableView *)self.superview;
    tableView.tableFooterView = self;
    [tableView reloadData]; // 重新刷新数据(会重新计算contentSize)
    //tableView.contentSize = CGSizeMake(0, self.bottom); 

 

UITableView的子控件高度不确定处理

原文:http://www.cnblogs.com/yintingting/p/5467696.html

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