为什么在Xcode 11上,UICollectionViewCell会在您滚动时立即更改大小(我已经在sizeForItem AtIndexPath:中设置了大小)? [英] Why on Xcode 11, UICollectionViewCell changes size as soon as you scroll (I already set size in sizeForItem AtIndexPath:)?

查看:106
本文介绍了为什么在Xcode 11上,UICollectionViewCell会在您滚动时立即更改大小(我已经在sizeForItem AtIndexPath:中设置了大小)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在tableview单元格内有collectionview,我将nib用于我的collection view单元格(在其中我对imageview和label使用autolayout,它处于Freeform模式下).我在tableviewcell类中设置单元格大小,该类通过这种方法在其中处理collectionview的委托:

I have collectionview inside tableview cell and I use nib for my collection view cell (in which I use autolayout for my imageview and labels and it is on Freeform mode). I'm setting cell size in tableviewcell class which is handling the delegate for collectionview inside it by this method:

 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return CGSize(width: 200, height :150)        
    }

它始终有效,但在Xcode 11之后无效.

It always works but after Xcode 11 it doesn't.

推荐答案

我有同样的问题.我的解决方案是在Xcode 11中将Estimate size更改为None.

I have the same problem. And my solution is to change the Estimate size to None in the Xcode 11.

这篇关于为什么在Xcode 11上,UICollectionViewCell会在您滚动时立即更改大小(我已经在sizeForItem AtIndexPath:中设置了大小)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆