tags:

views:

45

answers:

3

hi i am new to iphone. what i need is when ever i click the button open the google.com but it exit from application how can i launch url with in my application. pls help me post some code. thank u.

A: 

When you open an URL, MobileSafari will be launched. Unless your application is multi-task-handled, your application will quit when the URL is launched. Consider handling multi-tasking feature in iOS4. Read Apple documentation for more information.

Shivan Raptor
+2  A: 

try opening the url in uiwebView... It wont exit the application and will open up the URL in your application itself...

Try the below code on your click

    NSURL *url = [NSURL URLWithString:@"www.google.com"];    
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];    
    [self.webView loadRequest:requestObj];

Happy Coding

Suriya
+1  A: 

Create a UIWebView in your Interface Builder and connect it through an IBOutlet to your ViewController, when your are about to load the webpage

NSURL *url = [NSURL URLWithString:@"www.google.com"];
NSURLRequest *requestObj = [NSURLRequest requestWithU RL:url];
[self.webView loadRequest:requestObj];

RVN