And*_*nov 7 uikit ios uicollectionview ios8
在我的集合视图布局(我的子类UICollectionViewFlowLayout)中定义了:
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我的期望是,由于旋转是一个边界变化,我的布局将重新计算.但是,当我在以下位置设置断点时:
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout *)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
Run Code Online (Sandbox Code Playgroud)
屏幕旋转时不会触发断点.有谁知道为什么?
小智 2
collectionView:layout:sizeForItemAtIndexPath: 方法应在 UI CollectionViewDelegate 类中实现。不在 UICollectionViewLayout 的子类中。你在哪里实现的?
附言。没有必要同时使用两者。如果您有自定义 UICollectionViewLayout 类,请改用layoutAttributesForItemAtIndexPath:
| 归档时间: |
|
| 查看次数: |
2180 次 |
| 最近记录: |