简体   繁体   English

iOS 9中CPU使用率较高时出现奇怪的UICollectionView错误

[英]Strange UICollectionView error with high CPU usage in iOS 9

In iOS 8 all went well, but with iOS 9 I get this error message: the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values 在iOS 8中一切正常,但是在iOS 9中,我收到此错误消息: the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values

I have collectionView s embedded into tableView cells. 我有collectionView嵌入到tableView单元格中。 Any idea? 任何想法?

I tried self.automaticallyAdjustsScrollViewInsets = false , but it does not work. 我尝试了self.automaticallyAdjustsScrollViewInsets = false ,但是它不起作用。 DenseMapBase method is get called repeatedly. DenseMapBase方法被反复调用。

在此处输入图片说明 在此处输入图片说明

automaticallyAdjustsScrollViewInsets is most likely unrelated to this as it affects only the first UIScrollView (or it's descendant like UITableView ) in your view hierarchy. automaticallyAdjustsScrollViewInsets很可能与此无关,因为它仅影响视图层次结构中的第一个UIScrollView(或类似UITableView的后代)。 The "automatical scroll view inset adjustment" means that if you have an UINavigationBar in the view, the top content inset of the scroll view is set to the height of the UINavigationBar so that the bar doesn't overlap the scroll content when contentOffset is zero (scrolled to top), but the content can be scrolled under the bar and if the bar is not fully opaque you can see the content through (eg like in Safari). “自动滚动视图插入调整”意味着,如果视图中有UINavigationBar ,则将滚动视图的顶部内容插入设置为UINavigationBar的高度,以便当contentOffset为零时, contentOffset不会与滚动内容重叠(滚动到顶部),但是内容可以滚动到该条下方,如果该条不是完全不透明,则可以看到内容(例如,在Safari中)。

Please check the cell sizes returned by the delegate of the UICollectionView . 请检查UICollectionView 的委托返回单元格大小 That error is printed when the delegate returns a cell size that doesn't fit into the UICollectionView while respecting content and section insets. 当委托返回的单元格大小不适合UICollectionView同时尊重内容和节插图时,将显示该错误 Your collection view's scroll direction is probably horizontal? 您的收藏夹视图的滚动方向可能是水平的?

If so then the delegate method probably returns too big height value for the cell. 如果是这样,则委托方法可能会为单元格返回太大的高度值。 Here's an example: 这是一个例子:

  • UICollectionView has dimensions 100pt x 100pt UICollectionView的尺寸为100pt x 100pt
  • Top and bottom content insets are 5pt 顶部和底部内容插图均为5pt
  • Top and bottom section insets are 0pt (for simplicity) 顶部和底部插图为0pt(为简单起见)

The maximum height of the cell in this case would be 100pt - 2 * 5pt = 90pt 在这种情况下,单元的最大高度为100pt-2 * 5pt = 90pt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM