Skip to content

简易朋友圈图文混排,纯masonry布局,estimatedRowHeight自动计算高度无需另外计算cell高度

Notifications You must be signed in to change notification settings

XueYangLee/FriendDemo

Repository files navigation

FriendDemo

简易朋友圈,纯masonry布局,使用estimatedHeight自动计算高度而无需计算cell高度


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    FriendCell *cell=[tableView dequeueReusableCellWithIdentifier:@"friend"];
    if (!cell) {
        cell=[[FriendCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"friend"];
    }
    cell.model=self.dataArray[indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 290;
}

参考

About

简易朋友圈图文混排,纯masonry布局,estimatedRowHeight自动计算高度无需另外计算cell高度

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published