Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView experiences choppy scrolling when cell has a UIImageView subview
    primarykey
    data
    text
    <p>This has been driving me crazy for the better part of the day.</p> <p>I've got a UITableView with UIImageViews. These imageviews load a locally saved PNG-file in the cellForRow-function of the tableview, and this works fine except the tableview will stop scrolling for a fraction of a second when a cell with an image in it scrolls into sight so to speak. I've trawled StackOverflow and google for an answer but I've come up short - so any help will be greatly appreciated.</p> <p>Here is my code for the CellForRow-function:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"] autorelease]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } if([currSection isEqualToString:@"composer"]){ MySlide *s = [slidesArray objectAtIndex:indexPath.row]; cell.textLabel.hidden = YES; UIImageView *whiteView = [[UIImageView alloc] initWithFrame:CGRectMake((projectsTable.frame.size.width/2)-150, 4, 204.8, 153.6)]; if([s.slideImage isEqualToString:@""] || s.slideImage == nil){ //no custom image in this cell - go with default background image whiteView.image = [UIImage imageNamed:@"cellback2.png"]; whiteView.backgroundColor = [UIColor whiteColor]; }else{ cell.layer.shouldRasterize = YES; cell.layer.rasterizationScale = [UIScreen mainScreen].scale; NSData *data = [[NSData alloc] initWithContentsOfFile:s.slideImage]; UIImage *im = [[UIImage alloc] initWithData:data]; whiteView.image = im; whiteView.image = [self imageWithImage:whiteView.image CovertToSize:CGSizeMake(204.8,153.6)]; whiteView.backgroundColor = [UIColor whiteColor]; } [cell.contentView addSubview:whiteView]; [whiteView release]; cell.accessoryType = UITableViewCellAccessoryNone; } return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload