// 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]]]];
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...