سؤال

  • في الحالة الأولية، يحتوي عرض المجموعة الخاص بي على ثلاث خلايا، في قسم واحد: 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