ios - Getting images from the XML Links -
http://www.cinejosh.com/news/3/40889/high-court-dismisses-andhra-poris-case.html
in above link have tag
<img src="/newsimg/newsmainimg/1433410900_andhra-pori.jpg" alt="high court dismisses 'andhra pori's case" class="img-responsive center-block visible-xs">
i have above tag , need image on imageview.
my code this
nsstring *gossipsxpathquerystring = @"//td//img"; //imagegossipsnodes array data imagegossipsnodes = [gossipsparser searchwithxpathquery:gossipsxpathquerystring]; (tfhppleelement *element in imagegossipsnodes) { nsstring *imageurlstring = [nsstring stringwithformat:@"http://www.cinejosh.com%@", [element objectforkey:@"src"]]; }
now want pass string getting images.how achieve this?please me.
thanks
you have 2 options synchronous , asynchronous options. try use async methods.
uiimage *image = [uiimage imagewithcontentsofurl:[nsurl urlwithstring:imageurlstring]; yourimageview.image = image;
or
dispatch_async(dispatch_get_global_queue(0,0), ^{ nsdata * data = [[nsdata alloc] initwithcontentsofurl: [nsurl urlwithstring:imageurlstring]; uiimage *image = [uiimage imagewithdata: data]; dispatch_async(dispatch_get_main_queue(), ^{ yourimageview.image = image; }); });
Comments
Post a Comment