I have a slow scrolling in my table, the scroller has images that where loaded from web and resized, but the images are already loaded ,so i don't understand why the scrolling is going slow. I have read and tried slow scrolling of UITableView without success(i see empty cells)
This is the cell (it has also sections titles coded )
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSString *data=@"";
NSString *icon;
NSMutableArray *result=[allResults objectAtIndex:indexPath.section];
NSDictionary *dic=[result objectAtIndex:indexPath.row+1];
if([[result objectAtIndex:0] isEqualToString:@"types"])
{
NSString *title=[dic objectForKey:@"title"];
icon=[dic objectForKey:@"icon"];
data=[data stringByAppendingString:[NSString stringWithFormat:@"%@",title]];
}
if([[result objectAtIndex:0] isEqualToString:@"subServices"])
{
NSString *title=[dic objectForKey:@"title"];
icon=[dic objectForKey:@"icon"];
data=[data stringByAppendingString:[NSString stringWithFormat:@"%@",title]];
}
if([[result objectAtIndex:0] isEqualToString:@"businesses"])
{
NSString *title=[dic objectForKey:@"title"];
icon=[dic objectForKey:@"logo"];
data=[data stringByAppendingString:[NSString stringWithFormat:@"%@",title]];
}
cell.textLabel.numberOfLines = 1;
cell.textLabel.text = data;
cell.textLabel.textColor=[UIColor blackColor];
cell.textLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:22];
cell.textLabel.textColor=[UIColor colorWithRed:122.0/255.0 green:181.0/255.0 blue:196.0/255.0 alpha:1];
cell.imageView.layer.masksToBounds = YES;
//load image
NSURL *url = [NSURL URLWithString:icon];
NSData *imdata = [NSData dataWithContentsOfURL:url];
UIImage *logo=[UIImage imageWithData:imdata scale:1];
UIImage *scaled=[self resizeImage:logo imageSize:CGSizeMake(30, 30)];
cell.imageView.image=scaled ;
cell.imageView.layer.masksToBounds = YES;
cell.imageView.layer.cornerRadius = 12.0;
return cell;
}