ios - Alert before switch to maps if clicking on address in UIWebView -
ios - Alert before switch to maps if clicking on address in UIWebView -
i using next code observe if link clicked in uiwebview , show alert. user needs confirm leave app. detection addresses in active. if user tapping on address straight switch maps app apple. want observe show alert before switching maps app. how can observe if address(location) clicked in uiwebview?
-(bool) webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { savedlink = [request url]; if ( ( [ [ savedlink scheme ] isequaltostring: @"http" ] || [ [ savedlink scheme ] isequaltostring: @"https" ]) && ( navigationtype == uiwebviewnavigationtypelinkclicked ) ) { uialertview *leaveapp = [[uialertview alloc]initwithtitle:@"warning!" message:@"you want leave app?" delegate:self cancelbuttontitle:@"no" otherbuttontitles:@"yes", nil]; [leaveapp show]; homecoming no; } homecoming yes; } - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex { nsstring *title = [alertview buttontitleatindex:buttonindex]; if([title isequaltostring:@"yes"]) { [[uiapplication sharedapplication] openurl:savedlink]; } else if([title isequaltostring:@"no"]) { //do nil } }
i expecting maps.apple.com scheme called x-apple-data-detectors. if looking scheme working.
[[savedlink scheme] isequaltostring:@"x-apple-data-detectors"]
ios objective-c uiwebview maps
Comments
Post a Comment