Я загружаю изображения в фоновом режиме. используя этот код
-(void)backgroundImageLoading
{
if(isGroupOrFriend)
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
for(NSDictionary *d in m_kwikiArray)
{
NSMutableDictionary *dict=[NSMutableDictionary dictionary];
if([d valueForKey:@"UserImage"]!=nil && ![[d valueForKey:@"UserImage"] isEqualToString:@""])
{
UIImage *img=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[d valueForKey:@"UserImage"]]]];
if(img!=nil)
[dict setObject:img forKey:@"UserImage"];
}
else
[dict setObject:@"No Image" forKey:@"UserImage"];
//if([d valueForKey:@"imagePath"]!=nil && ![[d valueForKey:@"imagePath"] isEqualToString:@""] )
// [dict setObject:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[d valueForKey:@"imagePath"]]]] forKey:@"imagePath"];
// else
// [dict setObject:@"NO Image" forKey:@"imagePath"];
if([[d valueForKey:@"Transactions"] count]>0)
{
if([[[d valueForKey:@"Transactions"] objectAtIndex:0] valueForKey:@"UserThumbnail"]!= nil && ![[[[d valueForKey:@"Transactions"] objectAtIndex:0]valueForKey:@"UserThumbnail"] isEqualToString:@""])
{
UIImage *img1=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[[d valueForKey:@"Transactions"] objectAtIndex:0] valueForKey:@"UserThumbnail"]]]];
if(img1!=nil)
[dict setObject:img1 forKey:@"UserThumbnail1"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail1"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail1"];
if([[d valueForKey:@"Transactions"] count]>1)
{
if([[[d valueForKey:@"Transactions"] objectAtIndex:1] valueForKey:@"UserThumbnail"]!=nil && ![[[[d valueForKey:@"Transactions"] objectAtIndex:1] valueForKey:@"UserThumbnail"] isEqualToString:@""])
{
UIImage *img2=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[[d valueForKey:@"Transactions"] objectAtIndex:1] valueForKey:@"UserThumbnail"]]]];
if(img2!=nil)
[dict setObject:img2 forKey:@"UserThumbnail2"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail2"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail2"];
[imageForGruopAndFriendArray addObject:dict];
}
//isReloadTable=YES;
[mTable reloadData];
[pool release];
}
else
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
for(NSDictionary *d in m_kwikiArray)
{
NSMutableDictionary *dict=[NSMutableDictionary dictionary];
if([d valueForKey:@"Illustration"]!=nil && ![[d valueForKey:@"Illustration"] isEqualToString:@""])
{
UIImage *img=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[d valueForKey:@"Illustration"]]]];
if(img!=nil)
[dict setObject:img forKey:@"Illustration"];
}
else
[dict setObject:@"No Image" forKey:@"Illustration"];
if([d valueForKey:@"imagePath"]!=nil && ![[d valueForKey:@"imagePath"] isEqualToString:@""] )
{
UIImage *img1=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[d valueForKey:@"imagePath"]]]];
if(img1!=nil)
[dict setObject:img1 forKey:@"imagePath"];
}
else
[dict setObject:@"NO Image" forKey:@"imagePath"];
if([[d valueForKey:@"Transactions"] count]>0)
{
if([[[d valueForKey:@"Transactions"] objectAtIndex:0] valueForKey:@"UserThumbnail"]!= nil && ![[[[d valueForKey:@"Transactions"] objectAtIndex:0]valueForKey:@"UserThumbnail"] isEqualToString:@""])
{
UIImage *img2=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[[d valueForKey:@"Transactions"] objectAtIndex:0] valueForKey:@"UserThumbnail"]]]];
if(img2!=nil)
[dict setObject:img2 forKey:@"UserThumbnail1"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail1"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail1"];
if([[d valueForKey:@"Transactions"] count]>1)
{
if([[[d valueForKey:@"Transactions"] objectAtIndex:1] valueForKey:@"UserThumbnail"]!=nil && ![[[[d valueForKey:@"Transactions"] objectAtIndex:1] valueForKey:@"UserThumbnail"] isEqualToString:@""])
{
UIImage *img3=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[[d valueForKey:@"Transactions"] objectAtIndex:1] valueForKey:@"UserThumbnail"]]]];
if(img3!=nil)
[dict setObject:img3 forKey:@"UserThumbnail2"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail2"];
}
else
[dict setObject:@"NOImage" forKey:@"UserThumbnail2"];
[imageArray addObject:dict];
}
//isReloadTable=YES;
[mTable reloadData];
[pool release];
}
}
Здесь я использую reloadData внутри метода после каждой загрузки изображения, но он не загружает изображения, отображаемые после прокрутки таблицы.
Я хочу показать эти изображения, как только они загрузятся.
Пожалуйста, помогите мне. Спасибо заранее.