简体   繁体   中英

While clicking on some links on UIWebview it's automatically connect(go) to the itunes. but cannot get back to the app after clicking a iTunes link

Here we are using UIWebview related application. while clicking on some links, it's automatically connect(go) to the itunes. but it's cannot get back to the app after clicking a itunes link (with out clicking on Exit).

My Question is, how can come back to the app after clicking a itunes.

Try this one uiwebview delegate method.
 -(BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL* url = [request URL];
if (UIWebViewNavigationTypeLinkClicked == navigationType)
{
    [[UIApplication sharedApplication] openURL:url];
    return NO;
}
return YES;
}

you can add custom tool bar at the top of your view and add back button to custom tool bar to come back to your app. Below to custom tool bar add your webview.Hope it will helps you.

I usually insert a button next to UIWebView. Use a new view and insert button in any corner of view and then put your UIWebView, set your uiwebview is not fit to screen so you can push to exit button. When you tap to button than hide your view. ITs usually what i do for such situation, maybe it can help to you

When you click on any link and you now go to at this link of page and if you want to go previous to your application. Generally You can not go Back to your Application because Apple iOS does not provide this types of feature.

I am not sure but It may be possible in JB Device .

If you are loading the webpage with Safri or you are opening iTunes app with custom schema, it is not possible, because you are leaving the app. But yes you can do this, If you will load that itunes connect link through web view, and there you can place a custom back button to come back to your previous page.

For Example :

 UIWebView *webView=[[UIWebView alloc]init];
        [self.view addSubview:webView];
 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.xyz.com"]]];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM