美文网首页
计算更新collectionView的高度

计算更新collectionView的高度

作者: JohnayXiao | 来源:发表于2018-05-07 10:41 被阅读63次
//计算collectionView的高度
-(void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (collectionView == self.typeConllectionView) {
        
        dispatch_async(dispatch_get_main_queue(), ^{
            // 设置高度
            CGFloat tagViewHeight = self.typeConllectionView.contentSize.height;
            [self.typeConllectionView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.equalTo(@(tagViewHeight));
            }];
            
            [self.teacherListCollectionView layoutIfNeeded];
            
        });
    }
}

相关文章

网友评论

      本文标题:计算更新collectionView的高度

      本文链接:https://www.haomeiwen.com/subject/vhjmrftx.html