I am facing a problem that I do not find an answer I have a collection view, and every Once I tap a button, I reload the archive data with the new parameters. My problem is that it takes more than 1-2 times to do this, which is very upset and freezes my UI.
I would like to know that there is a way to reload the collection view in the background and display it only when it has been done (in some pseudo code):
self.collectionView.hidden = yes; Sending_assink ({{self.collectionView reload data};});
And when it is fully updated:
self.collectionView.hidden = no;
I have not found anything on this Internet, and I really need some help.
full code for Selforruattiaiandaksapth method:
- (UICollectionViewCell *) Collection see: (UICollectionView *) collectionView cellForItemAtIndexPath: (NSIndexPath *) Anukrmnikapath {UICollectionViewCell * cell = zero ; If (indexPath.row> = 1 & amp; Index Path Path & lt; = 7) {static NSString * cellIdentifier = @ "AGZDayLetterCell"; Cell = (AGZDayLetterCollectionViewCell *) [collectionView dequeueReusableCellWithReuseIdentifier: Selaidentifayr for Indekspath: Indekspath]; ((AGZDayLetterCollectionViewCell *) cell) .dayFirstLetterLabel.text = [self.daysFirstLetterArray objectAtIndex: (indexPath.row-1)]; Cell.userInteractionEnabled = NO; } And if (indexPath.row% 8 == 0) {static NSString * cellIdentifier = @ "AGZSeparatorCell"; Cell = [collectionView dequeueReusableCellWithReuseIdentifier: cell identifier in indexpath: indexpath]; Cell.userInteractionEnabled = NO; } Else if (indexPath.row & gt; 8 + self.delay) {NSString * dayNumberTapped = [NSString stringWithFormat: @ "% ld", (long) index Path.row-7- (int) indexPath.row / 8-self Delay]; Fixed NSString * cellIdentifier = @ "AGZDayCell"; Cell = (AGZDayCollectionViewCell *) [collectionView dequeueReusableCellWithReuseIdentifier: cell identifier for indexpath: indexpath]; ((AGZDayCollectionViewCell *) cell) .dateTappedString = [find himself: date number number]; NSDT * Selected DataData = [[Self MilitaratriDri Number: Day Number] DateFormostorFRC3339 Format]; ((AGZDayCollectionViewCell *) cell) .dayAppointmentsArray = (NSMutableArray *) [self.appointmentsDictionary objectForKey: [selected DayDate getDateOnlyRFC3339 format]]; // we have on the check that cell today and set design according to the results if ([[self.viewDate getDateOnly] is Akwltostring: [[NSDate date] getDateOnly]] & amp; [[NSDate date] getDay] == [Days numbered contents]) ((AGZDayCollectionViewCell *) cell) .isTodayDay = Yes; Else ((AGZDayCollectionViewCell *) cell) .isTodayDay = No; } And {static NSString * cellIdentifier = @ "AGZDayCell"; Cell = (AGZDayCollectionViewCell *) [collectionView dequeueReusableCellWithReuseIdentifier: cell identifier for indexpath: indexpath]; ((AGZDayCollectionViewCell *) cell) .dateTappedString = @ ""; Cell.userInteractionEnabled = NO; ((AGZDayCollectionViewCell *) cell) .isTodayDay = No; } Return cell; }
I think it is not very likely that this issue is the collection view Many people are using them in all kinds of ways with whom you are getting better. What is more likely that the data that the code generates is taking time. For example - a server is killing, this is the code that should be attached to a backbone or a full block on a background thread.
The UI code should never be on the background three and will cause all kinds of UI issues not running on the main thread.
No comments:
Post a Comment