i put uiimageviews table view cells , scrolling has been choppy. i'm assuming it's because images being reloaded each time cell appears, how preload/cache images? help.
code:
// customize appearance of table view cells. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithframe:cgrectzero reuseidentifier:cellidentifier] autorelease]; } // set cell... nsdictionary *dic = [self.issues objectatindex:indexpath.row]; cell.text = [dic objectforkey:@"date"]; cell.imageview.image = [uiimage imagewithcontentsoffile:[nsstring stringwithformat:@"%@/issues/%@/cover.png", documentsdirectory, [dic objectforkey:@"directory name"]]]; return cell; } - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return 150; }
excuse answer, there's complete ios sample application on apple's developer site explain trying do.
hint: uses gcd load images in background, displaying placeholder image.
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment