This is the code which I have done so far:
[userpic sd_setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:[UIImage imageNamed:@"blackSquare.png"] options:SDWebImageProgressiveDownload];
This is the code which I have done so far:
[userpic sd_setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:[UIImage imageNamed:@"blackSquare.png"] options:SDWebImageProgressiveDownload];
Below my code which little bit fast i feel. check with one. I am using Afnetwork
#import "UIImageView+AFNetworking.h"
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large",[[NSUSER objectForKey:@"user_info"] objectForKey:@"id"]]];
UIImage *pImage=[UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
_prof_pic_imageview.image=pImage;
I recommend to use SDWebImage instead..the method by @S.Karthik is good but will consume much more memory and will create View lag in your application. SDWebImage do simply same written by @karthik but too use cache so you don't need to fetch image every time while displaying.
try this
[userpic sd_setImageWithURL:[URLWithString:imageURL placeholderImage:[UIImage imageNamed:@"blackSquare.png"]]
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
//Image done
}];