0

I have an for loop , which consists of uiimageview inside it, everytime i add the image from the array which consits of url , i convert it to data and imagewithdata method am using it, it works for me perfectly but it takes long time , can we acheive it in lazy loading which is used in uitableview?

Pls help

Thanks in advance

KSR
  • 99
  • 1
  • 12
  • chk this may be it help you http://stackoverflow.com/questions/18486108/how-to-avoid-delay-when-adding-more-than-one-button-to-scrollview-in-iphone/18486398#18486398 – Aman Aggarwal Aug 29 '13 at 12:25
  • @KSR Please add your code. Also, there are plenty of questions on SO for lazy loading of images in `UITableView`, search well before asking duplicate questions. – Amar Sep 18 '13 at 09:01

1 Answers1

2

Instead of Lazzy Loading I used following way in UItableView and its working for me without scrolling issue .

 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^(void) {

            NSData *imageData ;

            imageData = [UICommonUtils imageDataFromString:profile.Photo];

            dispatch_sync(dispatch_get_main_queue(), ^(void) {


                    if([imageData length] > 1)
                    {
                        //UIImageView* imageView = (UIImageView*)[cell viewWithTag:100];
                        cell.ProfileImage.image = [UIImage imageWithData:imageData];
                    }
                    else
                    {
                        cell.ProfileImage.image = [UIImage imageNamed:kDefaultProfileImage];
                    }

                });

            imageData = nil;
        });
Divya Bhaloidiya
  • 5,018
  • 2
  • 25
  • 45