Note that there are some explanatory texts on larger screens.

plurals
  1. POImages change while scrolling the table in iphone?
    text
    copied!<p>I'm using the xml for fetching the data and display it in the uitable. In the XML i have a separate tag for the image as "link". I'm displaying this image as the cell image. Everything workings fine when the applications loads, but when i scroll the table the images in the cell are getting changed. </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType=UITableViewCellAccessoryNone; cell.selectionStyle=UITableViewCellSelectionStyleNone; //cell. separatorStyle=UITableViewCellSeparatorStyleNone; titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(110, 10, 190, 130)]; [titleLabel setTag:2]; titleLabel.numberOfLines=7; [titleLabel setFont:[UIFont systemFontOfSize:14]]; [titleLabel setTextColor:[UIColor blackColor]]; [titleLabel setBackgroundColor:[UIColor clearColor]]; [cell.contentView addSubview:titleLabel]; [titleLabel release]; imageView= [[UIImageView alloc] initWithFrame:CGRectMake(5, 20, 90, 110)]; [cell.contentView addSubview:imageView]; } NSDictionary *appRecord = [responseArr objectAtIndex:indexPath.row]; NSString *urlLink; urlLink=[NSString stringWithFormat:@"%@",[appRecord objectForKey:@"link"]]; NSLog(@"LINK : %@",urlLink); if([urlLink length] ==0) { imageView.image=[UIImage imageNamed:@"ioffer.png"]; } else { NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlLink]]; UIImage *image = [[UIImage alloc] initWithData:imageData]; imageView.image = image; } UILabel *desclbl = (UILabel*)[cell.contentView viewWithTag:2]; desclbl.text = [NSString stringWithFormat:@"%@",[appRecord objectForKey:@"description"]]; return cell; } </code></pre> <p>I have used these code in the table's cellForRowAtIndexPath. responseArr is the array where i stored the links.</p> <p>Can any one help me in this issue.</p> <p>Thanks in advance Malathi</p>
 

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