头大的一篇日志 细节总结 唐诗三百首

首先最令人头疼的问题 cell随着label的自动行高问题

下面几行代码解决了,,,,

 

 self.tableView.estimatedRowHeight = 120; 预设行高

 _label.numberOfLines = 0;

self.tableView.rowHeight = UITableViewAutomaticDimension;

设置label 利用masonry

[cell.label mas_makeConstraints:^(MASConstraintMaker *make) {
       make.edges.equalTo(cell).with.insets(UIEdgeInsetsMake(5,5,5,5));
    }];

解释这样解决问题了

// Returning this value from tableView:heightForHeaderInSection: or tableView:heightForFooterInSection: results in a height that fits the value returned from
// tableView:titleForHeaderInSection: or tableView:titleForFooterInSection: if the title is not nil.

UITableViewAutomaticDimension

 关于添加tableView视图到viewcontroller得view中后,实现协议的后,tableView上面出现的一大块空白的解决方法

://iOS 7 viewcontroller新增属性automaticallyAdjustsScrollViewInsets,即是否根据按所在界面的navigationbar与tabbar的高度,自动调整scrollview的 inset,设置为no,让它不要自动调整就可以了
    self.automaticallyAdjustsScrollViewInsets =NO;

posted @ 2015-12-25 20:22  严_青  阅读(219)  评论(0编辑  收藏  举报