ios - Icon downloader downloads images only when UITableViewcell is outside screen.iPhone -
I tried to search but no solution was found useful.
I am using the following code for the mouse to bring laziness while loading. The point is, icons are downloaded through lazy loading, but this is only seen once that the special cell is out of the screen and scrolls back in the screen.
I think that this is some problem with dequeueReusableCellWithIdentifier, but I'm not sure how to solve it, the images have been downloaded properly, but after the cell is out of the screen only visible in the cell Will give.
// ----------------- --------------------- ----------------------------- ------------ // tableView: CellularUroutedExp //: ---------------------------- ---------------------- --------------------------- - (UITableViewCell *) TableView: (UITableView *) tableVw cellForRowAtIndexPath: (NSIndexPath *) indexPath {// Table Customize the appearance of visual cells / / static NSString * CellIdentifier = @ "LazyTableCell"; Fixed NSString * Placeholder for Identifier = @ "PlaceholderCell"; // Add a placeholder cell while waiting on the table data NSUInteger NodeCount = [Data Count]; If (nodecount == 0 and indexPath.row == 0) {UITableViewCell * cell = [table view dequeueReusableCellWithIdentifier: PlaceholderCalendar;]; Cell.detailTextLabel.text = @ "Loading ?? |" "; Return cell;} UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier]; if (! Cell) {cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleSubtitle again: user: cell identifier];} Cell.backgroundColor = [UIColor grayColor]; // If there is no data yet, then empty cells remain empty (node count & gt; 0) {// set up the cell ... AppRecord * appRecord = [DataAre ObjectAntx: IndexPath.ro]; Cell.textLabel.text = AppRecord.appName; Cell.detailTextLabel.text = appRecord.artist; // Load only the cached image; New downloads will be available until the scrolling is over Can (if! AppRecord.appIcon) {if (tableView.dragging == no & amp; amp; amp;; & amp;; table; DCLERING == no) {[auto start size download: indexpath for app reference: Indexpath];} // If a download is deferred or in progress, return the placeholder image cell. ImageView.image = [UIImage imageNamed: @ "Placeholder.png"];} and {cell.imageView.image = appRecord.appIcon; }} Return Cell;} - (Zero) Start Icon Download (Appointment *) Apprecord for Index Path: (NSINXPath *) IndexPath {Icon Dow * Loader icon Downloader = [Imejdounlods in progress Objektforki: Indekspeth]; If (Icon Downloader == zero) {iconDownloader = [[IconDownloader Elok] IIT]; IconDownloader.appRecord = appRecord; [IconDownloader setCompletionHandler: ^ {UITableViewCell * cell = [table view cellforoutindexpath: indexpath]; // Display new load image cell ImageView.image = appRecord.appIcon; // Remove the icon Deloder from the progress list. // Its results will be deloculated [image download inject.gif objectphoric: indexpath]; }]; [Image Download Progress Set Object: For Icon Downloader: IndexPath]; [Download icon downloader]; }} - (void) load images Forensrokrojh {if ([Detaare count]> gt; {NSArray * visiblePaths = [table view index Prishtforivibl]; (Ansaianaksapth * Indekspeth appeared Ptha to) {app records * Aprekord = [Detaare Objektotandaks: Indekspathkro]; if (! AppRecord.appIcon) // Avoid app icon download, if the app is already an icon in the {{staff Aicondaunlodः app Records for Indekspath: Indekspath];}}}} #pragma mark - UIScrollViewDelega te - (minus) scrollViewDidEndDragging: (UIScrollView *) scrollview willDecelerate: (! His speed) (bool) pace {if {[self loadImagesForOnscreenRows];}} - scrollViewDidEndDecelerating (zero): (UIScrollView *) scrollView {[self loadImagesForOnscreenRows]
I did the code like the following,
SDWebImageManager * manager = [SDWebImageManager sharedManager]; [manager downloadWithURL: aURL options: 0 progress: no complete: ^ (UIImage * image, NSError * error, SDImageCacheType cacheType, finished BOOL) {if (image) [aCell.imgViewThumb SetImage: image]; That [aCell.imgViewThumb setImage: [UIImage imageNamed: @ "dummy-image.jpg"]]; [ACell.indicator stopAnimating]; }];
Comments
Post a Comment