J'ai mis une image dans ma cellule tableview dans laquelle l'image est située dans une certaine URL .. Mon problème est que lorsque ma tableView affiche déjà les données, puis défilement la table view up & vers le bas, il faudra un certain temps ou de retard avant de réagir au défilement ..Image dans la cellule TableView provoque un retard lors du défilement
J'ai découvert le problème est dans l'image située dans l'URL et je dois également afficher chaque image dans le cellule tableview. Une idée de comment je peux le réparer? ou être optimisé?
Voici mon code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell
NSUInteger row = [indexPath row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
NSArray *arrLocal = [m_list objectAtIndex:row];
if ([arrLocal count] > 0) {
cell.textLabel.text = [arrLocal objectAtIndex:2];
cell.textLabel.font = [UIFont boldSystemFontOfSize:14];
cell.detailTextLabel.text = [arrLocal objectAtIndex:3];
cell.detailTextLabel.font = [UIFont systemFontOfSize:12];
//sample url of the image: http://www.mysite.com/images/DealExtreme/2657_1_small.jpg
NSString *strTemp = [[NSString alloc] initWithString:@"http://www.mysite.com/"];
NSString *urlString = [strTemp stringByAppendingString: [arrLocal objectAtIndex:1]];
NSURL *url = [NSURL URLWithString:urlString];
UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];
cell.imageView.image = image;
[strTemp release];
}
return cell;
}
Oui, c'est ... Merci –