0
我有一行collectionView。在開始時的性能目的中,我只加載了部分項目並滾動(讓它成爲)第30項的第6項。然後,我在開始時插入其餘項目(可以是100),並且集合視圖切換到新的6元素不停留在舊的。我試着在插入完成時使用scrollToItemAtIndexPath,但它先顯示新的項目,然後切換到舊的。UICollectionView。如何在場景後面插入新項目?
如何在場景後面插入新項目?我的意思是強制collectionView的行爲方式,如果沒有更新的地方和所有項目總是?
- (void)addDateStorage
{
NSDate* currentPastDate = [dateStorage objectAtIndex:0];
NSMutableArray* indexPathes = [NSMutableArray array];
for(int i=0; i<DAYS_IN_YEAR; i++)
{
[dateStorage insertObject:currentPastDate atIndex:0];
currentPastDate = [currentPastDate dateByAddingTimeInterval:SECONDS_IN_DAY*(-1)];
[indexPathes addObject:[NSIndexPath indexPathForRow:i inSection:0]];
}
[self.calendar insertItemsAtIndexPaths:indexPathes];
}
我試過使用performBatchUpdates:和reloadData,但我有同樣的結果。
我試過了,但它的行爲方式相同(((( –
你可以發佈你的代碼? – Tala