NSData is not getting memory or data dynamically

Discussion in 'iPhone' started by AbhishekApple, Aug 26, 2010.

  1. AbhishekApple macrumors member

    Aug 5, 2010
    Whn i call setProductImage() method the NSData gets data only for the first time in the loop so only first image is displayed..
    I have checked the url it is retrieving the image every time. but data is not loaded in NSData

    Their is no error in the tableview only first cell gets image and label values but other cells gets only label values.

    (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *imgPath = [NSString alloc initWithFormat:@"http://www.xyz.com.com/images/%@",arryImage objectAtIndex:indexPath.row];
    cell setProductImage:imgPath;
    return cell;
    (void)setProductImage:(NSString *)_text;{
    NSData * imageData = [[NSData alloc initWithContentsOfURL:NSURL URLWithString:_text]] autorelease;
    imgProduct.image = UIImage imageWithData: imageData; //UIImageView imgProduct 
  2. AbhishekApple thread starter macrumors member

    Aug 5, 2010
    it is solved, actually the array items had whitespace thats why it was not allocating memory
    eg: http://xyz.com/images/ 30.jpg

Share This Page