2012-12-07 3 views
6

서브 클래스가 UICollectionViewLayout입니다. 여태까지는 그런대로 잘됐다.
그러나 화면보다 더 넓은 셀이 있고 스크롤하는 동안 사라지는 경우가 있습니다. 좀 더 스크롤하면 마술처럼 다시 나타납니다. 내 코드를 보여줄 수는 있지만, 90 %의 케이스에서 작동하므로 아무 문제가 없다고 생각합니다. 그러나 실제로는 큰 셀 (화면 크기의 두 배 이상)이 때때로 사라집니다. UICollectionView's cell disappearingLarge cells in a UICollectionView getting removed while the cell is still displayed 그러나, 해결책은 언급되지 않습니다커스텀 레이아웃으로 커다란 UICollectionViewCell이 사라졌습니다

NSMutableArray* attributes = [NSMutableArray array]; 
for (int section=0; section < [[self collectionView] numberOfSections]; section++) { 
    [attributes addObject:[self layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]]]; 
     for (int row=0; row < [[self collectionView] numberOfItemsInSection:section]; row++) { 
      NSIndexPath* indexPath = [NSIndexPath indexPathForItem:row inSection:section]; 
      [attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]]; 
     } 
} 
return attributes; 

나는 이러한 게시물을했습니다. 아무도 이걸 도와 줄 수 있니? 문제가 애플 측에있을 수 있습니까? 그리고 있다면, 내가 직접 해결할 수있는 것이 있습니까?

답변

5

죄송합니다. UICollectionView의 실제 버그입니다. 몇 주 전에 똑같은 일을 겪었습니다. 나는 버그를 보여주기위한 작은 프로그램을 만들었고 애플에게 레이다를 신청했지만, 그것을 고칠 계획이 있는지에 대해 다시들은 바가 없다. 내가 생각할 수있는 최선의 해결 방법은 (경고 : 아직이 해결 방법을 구현하지 못했습니다.) 레이아웃 속성이 화면 가장자리에서 너무 멀리 떨어져 있고 의도적으로 셀 속성의 경계를 약간 변경되도록 고지하는 것입니다. 화면에 표시하고 layoutAttributes의 추가 사용자 정의 필드로 오프셋 (실제로 경계가 정돈되어 있어야하는 양)을 저장할 수 있으므로 셀이 내용을 올바르게 그릴 수 있습니다. 어떤 거대한 해킹처럼 느껴지지만 작동해야합니다.

+0

들으셨습니까? 개입 시간? –

0

-(NSArray*)layoutAttributesForElementsInRect:(CGRect)rect 메서드가 호출되고 rect가 셀의 일부일 때이 셀에 대한 올바른 특성 개체를 반환 하시겠습니까?

+0

사용자는 또한 매우 큰 셀에 문제가 있다고보고합니다. 참조 : http://stackoverflow.com/questions/13016302/large-cells-in-a-uicollectionview-getting-removed-while-the-cell-is-still-displa?rq=1 – CitronEvanescent

관련 문제