ios - Passing a xml url link to view with UIWebView from lazytablevimage? -
example xml
<feed xmlns:im="http://itunes.apple.com/rss" xmlns="http://www.w3.org/2005/atom" xml:lang="en"> <entry> <im:title>como una virgen para cristo</im:title> <im:url>listindiario.com</im:url> </entry>
everything work perfect...
but question how can when press load cell link url open view uiwebview?
i'm working storyboard
this code: apptableviewcontroller.m
#import "apptableviewcontroller.h" #import "apprecord.h" #import <sdwebimage/uiimageview+webcache.h> #import "customcell.h" #import "webview.h" #import "parseoperation.h" @class webview; @implementation apptableviewcontroller #pragma mark - table view creation (uitableviewdatasource) - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [self.entries count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"lazytablecell"; customcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; apprecord *apprecord = (self.entries)[indexpath.row]; cell.nametext.text = apprecord.appname; cell.detalletext.text = apprecord.artist; cell.durationtext.text= apprecord.appduration; cell.datetext.text= apprecord.appdate; [cell.myimage setimagewithurl:[nsurl urlwithstring:apprecord.imageurlstring] placeholderimage:[uiimage imagenamed:@"backgorundlogocell.png"]]; cell.detalletext.text = apprecord.artist; return cell; }
parseoperation.m
#import "parseoperation.h" #import "apprecord.h" #import "tfhpple.h" #import "tfhppleelement+keyedsubcript.h" @interface parseoperation () @property (nonatomic, copy) arrayblock completionhandler; @property (nonatomic, strong) nsdata *datatoparse; @end @implementation parseoperation - (id) initwithdata:(nsdata *)data completionhandler:(arrayblock)handler { self = [super init]; if (self != nil) { self.datatoparse = data; self.completionhandler = handler; } return self; } - (void)main { nsmutablearray *workingarray = [nsmutablearray array]; tfhpple *appparser = [tfhpple hpplewithxmldata:self.datatoparse]; nsstring *appxpathquerystring = @"//xmlns:entry"; nsarray *appsarray = [appparser searchwithxpathquery:appxpathquerystring]; (tfhppleelement *element in appsarray) { apprecord *app = [[apprecord alloc] init]; app.appname = [[element firstchildwithtagname:@"title"] text]; app.imageurlstring = [[element firstchildwithtagname:@"image"] text ]; app.artist = [[element firstchildwithtagname:@"pastor"] text]; app.appduration = [[element firstchildwithtagname:@"duration"] text]; app.appdate = [[element firstchildwithtagname:@"date"] text]; app.appurl = [[element firstchildwithtagname:@"url"] text]; [workingarray addobject:app]; } self.completionhandler(workingarray); self.datatoparse = nil; }
to respond on touch in cell of uitableview have implement method....
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath
in method can initialize view , pass link according cell new view.
to load webpage in webview needed write this...
nsurl *url = [nsurl urlwithstring:urladdress]; nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; [webview loadrequest:requestobj];
Comments
Post a Comment