문제

  • 초기 상태에서 내 컬렉션 보기에는 한 섹션에 세 개의 셀이 있습니다. cell1, cell2 그리고 cell3.

  • 다음 상태에서는 첫 번째 셀이 변경되어 cell1_bis.같은 크기입니다.

이 변화에 애니메이션을 적용할 수 있나요? cell1 -> cell1_bis?

도움이 되었습니까?

해결책

답변

다음과 같이 진행하세요.

 [self.collectionView

 performBatchUpdates:^
 {
     NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
                                                          inSection:section] ;

     [self.collectionView deleteItemsAtIndexPaths:@[whereTheChangeIs]] ;
     [self.collectionView insertItemsAtIndexPaths:@[whereTheChangeIs]] ;
 }

 completion:^(BOOL finished)
 {
     // nothing
 }] ;

질문

불행히도 다음은 작동하지 않습니다.벌레?

 [self.collectionView

 performBatchUpdates:^
 {
     NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
                                                          inSection:section] ;

     [self.collectionView reloadItemsAtIndexPaths:@[whereTheChangeIs]] ;
 }

 completion:^(BOOL finished)
 {
     // nothing
 }] ;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top