Slow loading the images from URL in UITAbleView.

后端 未结 9 688

I\'m loading the images from URL in UITableView. But it\'s very slow when loading an view. Here\'s an example,

UIImage *image = nil;
image = [UIImage imageW         


        
相关标签:
9条回答
  • 2020-12-20 10:28

    maybe you can use asihttprequest to lazy load images. use ASINetworkQueues

    0 讨论(0)
  • 2020-12-20 10:33

    Load image asynchronously

    NSURL* url = [NSURL URLWithString:@"http://calcuttans.com/palki/wp-content/uploads/2009/02/kidscover-small.png"];
        NSURLRequest* request = [NSURLRequest requestWithURL:url];
    
    
    [NSURLConnection sendAsynchronousRequest:request
            queue:[NSOperationQueue mainQueue]
            completionHandler:^(NSURLResponse * response,
                NSData * data,
                NSError * error) {
        if (!error){
                NSImage* image = [[NSImage alloc] initWithData:data];
            // do whatever you want with image
        }
    
    }];
    
    0 讨论(0)
  • 2020-12-20 10:34

    Try to implement AFNetworking. It uses async requests to download the image, you are currently blocking your view with every download.

    You can then use an AFImageRequestOperation to download your image.

    0 讨论(0)
提交回复
热议问题