user1832451
user1832451

Reputation:

Open URL Within App in Xcode

In my application I want a URL to be open within the app not in safari, Thank You.

Upvotes: 1

Views: 6684

Answers (1)

Aaron Wojnowski
Aaron Wojnowski

Reputation: 6480

UIWebView is your answer if you want to load a webpage inside of your app.

// example:

UIWebView *webView = [[UIWebView alloc] init];
[webView setFrame:CGRectMake(0, 0, 320, 460)];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]];
[[self view] addSubview:webView];

If you really want to get fancy, you can use your own UIApplication subclass and intercept the OpenURL method in your application and then pop up a modal view or something along those lines to open the URL in your app, when it normally would have opened the URL outside of your app.

Upvotes: 3

Related Questions