i consuming html json data in ios app. html response has few div blocks onclick methods. when tap on these blocks invoke javascript code in web view, need know these events in source code.
for example when tap on web element , onclick called need invoke method in code .
- (void)patientresponse:(uiwebview *)webview modedict:(nsdictionary *)modedict - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { nsstring *protocolprefix = event; nsstring *urlstr = [[request url].absolutestring substringfromindex:protocolprefix.length]; urlstr = [urlstr stringbyreplacingpercentescapesusingencoding:nsutf8stringencoding]; nserror *jsonerror; nsdictionary *callinfo = [nsjsonserialization jsonobjectwithdata:[urlstr datausingencoding:nsutf8stringencoding] options:kniloptions error:&jsonerror]; if([[callinfo valueforkey:@"acton"] isequaltostring:set_id]) [self patientresponse:webview modedict:callinfo]; return no; } - (void)patientresponse:(uiwebview *)webview modedict:(nsdictionary *)modedict { nsstring *mode = [[modedict valueforkey:@"params"] valueforkey:@"patientname"]; self.patientname = mode; nslog(@"patient name is:%@",self.patientname); }
you can use textview insted of uiwebview. use attributed string load html response on textview. hope help.
Comments
Post a Comment