i have collectionview 1 row. in performance purposes on start load part of items , scroll (let be) 6th item of 30. insert rest of items (it can hundred) in beginning , collection view switches new 6 element not stays on old. i've tried use scrolltoitematindexpath on insertion completion, shows new item first , switching old.
how insert new items behind scene? mean force collectionview behave in way if no updates made , items were?
- (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]; }
i've tried use performbatchupdates: , reloaddata, have same result.
first, need modify model (load more elements).
second, tell collectionview reload data (it should see updated number of elements , still show visible elements) , no scrolling needed.
Comments
Post a Comment