UITableView+FDTemplateLayoutCell配合Mansonry的使用

注意点 1

指定最下面view的bottom约束,这样才能够确切的计算出Cell的高度。


[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {   
 make.left.equalTo(self.iconView);
 make.top.equalTo(self.iconView.bottom).with.offset(10); 
 make.right.equalTo(-10);
 make.bottom.equalTo(-10); //重要 
}];

注意点 2

iOS7设备上Cell默认高度44的约束冲突
<NSLayoutConstraint UITableViewCellContentView.height == 44>
需要在Cell初始化的时候设置contentView的autoresizingMask值

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 
{
         self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
          if (self)
              {
                self.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
              }
        return self;
}

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容