UICollectionView无法滚动以查看整个最后一行 [英] UICollectionView not able to scroll to see the entire last row

查看:679
本文介绍了UICollectionView无法滚动以查看整个最后一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大小为: 768x1024 的UICollectionView,顶部有一个导航栏。我的自定义 UICollectionViewCells 的大小 200x200 。问题是当我不断添加单元格并且到达底行时,我只能看到 200x200 单元格的一部分。它不会让我在它反弹之前进一步滚动。关于问题可能是什么想法?

I have a UICollectionView with size: 768x1024 with a navbar on top. My custom UICollectionViewCells are of size 200x200. The problem is that when I keep adding cells and I reach the bottom row, I can only see part of the 200x200 cell. It won't let me scroll further before it bounces back up. Any ideas on what the problem could be?

编辑:

我通过以下方式添加单元格:

I add cells via:

insertItemsAtIndexPaths:

推荐答案

问题只是将AutoLayout约束添加到View Controller中,该控制器包含 UICollectionView 。为此,请在Storyboards中选择View Controller,然后单击顶部的Editor。然后,解决Autolayout问题>重置为建议的限制......

The issue was just adding AutoLayout constraints to the View Controller which housed the UICollectionView. To do this, select the View Controller in Storyboards and click on "Editor" on the top. Then, "Resolve Autolayout Issues" > "Reset to Suggested Constraints..."

这篇关于UICollectionView无法滚动以查看整个最后一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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