Reputation: 723
I need to display a preview of the website with given url
in the single image(e.g. like Facebook
do in Messenger
when you sending a url
to someone). Is there any way to achieve that without actually loading the html file
and reading it's metadata
?
Upvotes: 1
Views: 344
Reputation: 27448
Try this,
NSString *urlStr = @"http://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-icon.png?v=c78bd457575a";
NSURL *url=[NSURL URLWithString: urlStr];
NSData *data=[NSData dataWithContentsOfURL:url];
UIImage *image=[[UIImage alloc] initWithData:data];
UIImageView *imagview = [[UIImageView alloc]initWithImage:image];
imagview.frame = CGRectMake(250, 500, 100, 100);
[self.view addSubview:imagview];
This will give just thumb or image. You can use URLEmbeddedView Library for more functionality. I think this is the library what you want.
Upvotes: 2