简单自动布局
应用介绍
源码SDAutoLayout,一行代码搞定自动布局!致力于做最简单易用的Autolayout库。tableview cell 自动高度设置只需要3步 1. >> 设置cell高度自适应: // cell布局设置好之后调用此方法就可以实现高度自适应(注意:如果用高度自适应则不要再以cell的底边为参照去布局其子view) [cell setupAutoHeightWithBottomView:_view4 bottomMargin:10]; 2. >> 设置 tableview 数据源和代理 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // 2.1 注册模型cell [self.tableView startAutoCellHeightWithCellClass:“cell类名” contentViewWidth:“contentview宽度”]; return _rowCount; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // 2.2 根据模型取得cell高度 return [self.tableView cellHeightForIndexPath:indexPath model:“model” keyPath:@"model属性名"]; }

发表评论 取消回复