-1
// custom delegate that takes value in retrieved data array ::
-(void)repaint:(NSMutableArray *)retrievedData
{
    if (retrievedData.count > 0)
    {
        userObj = [retrievedData objectAtIndex:0];

        url_Img1=@"http://kiascenehai.pk/assets/uploads/event-images/50x50-thumb/";
        url_Img2=userObj.event_dpURL;
        url_Img_FULL = [url_Img1 stringByAppendingPathComponent:url_Img2];

       [tableData addObjectsFromArray:retrievedData];
        [table reloadData];
      }
}

This code is printing a single image several times.

[[cell imageView] setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL       URLWithString:url_Img_FULL]]]];
trojanfoe
  • 120,358
  • 21
  • 212
  • 242

1 Answers1

0

It's probably this line, where you always take the first object from the array:

userObj = [retrievedData objectAtIndex:0];
//                                     ^

Use Fast Enumeration instead:

-(void)repaint:(NSMutableArray *)retrievedData
{
    for (WhateverType *userObj in retrievedData)
    {
        url_Img1=@"http://kiascenehai.pk/assets/uploads/event-images/50x50-thumb/";
        url_Img2=userObj.event_dpURL;
        url_Img_FULL = [url_Img1 stringByAppendingPathComponent:url_Img2];

       [tableData addObjectsFromArray:retrievedData];
        [table reloadData];
      }
}

Note: none of the variables in that method should be an instance variable, other than tableData and table. Also that URL manipulation code looks dodgy, but that's a different story...

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • sorry, but i am not able to understand this and also its not working using fast enumeration as: for (userobj in retreivedData), it still displaying the same image several times – user3807662 Jul 25 '14 at 17:49