From b6579c6a099c79cc8e5600811af562ec56ab95da Mon Sep 17 00:00:00 2001 From: opa334 Date: Fri, 12 Jan 2024 20:10:32 +0100 Subject: [PATCH] Attempt to fix icons bugging out --- TrollStore/TSAppTableViewController.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TrollStore/TSAppTableViewController.m b/TrollStore/TSAppTableViewController.m index fae8585..63756b6 100644 --- a/TrollStore/TSAppTableViewController.m +++ b/TrollStore/TSAppTableViewController.m @@ -375,14 +375,15 @@ UIImage* imageWithSize(UIImage* image, CGSize size) cell.imageView.image = _placeholderIcon; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ { - //usleep(1000 * 5000); // (test delay for debugging) UIImage* iconImage = imageWithSize([UIImage _applicationIconImageForBundleIdentifier:appId format:iconFormatToUse() scale:[UIScreen mainScreen].scale], _placeholderIcon.size); _cachedIcons[appId] = iconImage; dispatch_async(dispatch_get_main_queue(), ^{ - if([tableView.indexPathsForVisibleRows containsObject:indexPath]) + NSIndexPath *curIndexPath = [NSIndexPath indexPathForRow:[_cachedAppInfos indexOfObject:appInfo] inSection:0]; + if([tableView.indexPathsForVisibleRows containsObject:curIndexPath]) { - cell.imageView.image = iconImage; - [cell setNeedsLayout]; + UITableViewCell *curCell = [tableView cellForRowAtIndexPath:curIndexPath]; + curCell.imageView.image = iconImage; + [curCell setNeedsLayout]; } }); });