Решение: используйте SDWebImage: https://github.com/rs/SDWebImage
У меня есть UITableView, который во время прокрутки становится очень слабым. Я обнаружил, что отставание появляется, когда изображение, которое я использую, возвращается на экран.
Я использую пользовательский UITableViewCell. Это также причина, по которой она отстает?
Мой пользовательский UITableViewCell:
Мой код:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%d%d",indexPath.row,indexPath.section];
tableViewCellActiviteiten *cell = (tableViewCellActiviteiten *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"tableViewCellActiviteiten" owner:self options:nil];
cell = (tableViewCellActiviteiten *)[nib objectAtIndex:0];
}
cell.thetitle.text = [self.alletitels objectAtIndex:indexPath.row];
cell.thesubtitle.text = [self.allesubtitels objectAtIndex:indexPath.row];
NSString * imagePath = [self.alleimages objectAtIndex:indexPath.row];
NSURL * imageURL = [NSURL URLWithString:imagePath];
NSData * imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage * image = [UIImage imageWithData:imageData];
cell.image.image = image;
return cell;
}
Содержимое массивов:
self.alletitels
содержит строку: "Title Activity"
self.allesubtitels
содержит строку: "Субтитр активности"
self.alleimages
содержит URL: " http://m2.myhappygames.com//files/pics/0/Paranormal_Shark_Activity_3.jpg"
Может ли кто-нибудь посоветовать, что может быть причиной медленной прокрутки?