UICollectionView :셀의 변화를 애니메이션으로 만드는 방법은 무엇입니까?
문제
초기 상태에서 내 컬렉션 보기에는 한 섹션에 세 개의 셀이 있습니다.
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
}] ;
제휴하지 않습니다 StackOverflow