預設,奇怪的消失項目時滾動
我有collectionViewFlowLayout子與
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
return YES;
}
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
NSArray *arr = [super layoutAttributesForElementsInRect:rect];
BBLog(@"ARRA:%@", arr);
for (UICollectionViewLayoutAttributes *attr in arr) {
if (CGAffineTransformIsIdentity(attr.transform)) {
attr.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
}
}
return arr;
}
的CollectionView旋轉倒掛與
self.collectionView.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
滾動但是,即使強制使用本地collectionViewFlowLayout沒有子,一個git這個錯誤
問題
我有兩條消息和更多的聊天,但當滾動底部(正常情況下)消失第二項。
layoutAttributesForElementsInRect對於給定的矩形回報兩個indexPaths 0-0和0-1兩個屬性,但委託方法
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
稱爲僅供indexPath 0-0
這裏圖像
UPDATE 所以我發現它爲什麼會發生 - 這行代碼
attr.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
看,如果刪除變換
swift的任何解決方案? – DeyaEldeen
在swift中沒有測試,現在只在objc中編碼。但我認爲同樣的問題將會發生。 –