Presets,mục biến mất kỳ lạ khi cuộn
tôi có collectionViewFlowLayout lớp con với
- (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 xoay để lộn ngược cuộn với
self.collectionView.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
Nhưng ngay cả khi jus sử dụng collectionViewFlowLayout mẹ đẻ mà không subclassing, a git lỗi này
Sự cố
Tôi có hai tin nhắn và nhiều nội dung khác trong trò chuyện, nhưng khi cuộn ở dưới cùng (trên cùng bình thường) sẽ biến mất mục thứ hai.
layoutAttributesForElementsInRect cho trao rect trở lại hai thuộc tính cho hai indexPaths 0-0 và 0-1, nhưng phương pháp đại biểu
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
gọi là chỉ dành cho indexPath 0-0
Dưới đây hình ảnh
CẬP NHẬT Vì vậy, tôi tìm thấy TẠI SAO nó xảy ra - điều này dòng mã
attr.transform = CGAffineTransformMakeRotation((CGFloat)M_PI);
Look nếu remove chuyển
bất kỳ giải pháp nào cho việc nhanh chóng? – DeyaEldeen
Trong nhanh chóng không kiểm tra, bây giờ mã hóa chỉ trong objc. Nhưng tôi nghĩ rằng cùng một vấn đề sẽ được. –