10

I currently have a view with four buttons, and would like to be able to launch UIWebview with a specific url for each different button.

I currently am able to launch safari externally with the urls.

I know I can have the code to show the UIWebview within each button, and can set the url withing the viewDidLoad of the UIWebview, but I need a way to load a specific page depending on which button was pressed.

Regards

Phillip Senn
  • 46,771
  • 90
  • 257
  • 373
some_id
  • 29,466
  • 62
  • 182
  • 304

1 Answers1

26

somtheing like this should be called in the IBAction for the buttom click. you can specify a different URL based on the sender

UIWebView *webView = [[UIWebView alloc] initWithFrame: CGRectMake(0.0, 0.0, 1.0, 1.0)];  
webView.delegate = self;

NSURLRequest *request = [[NSURLRequest alloc] initWithURL: [NSURL URLWithString: @"www.url.com"] cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval: myTimeoutValue];  
[self.webView loadRequest: request];  
Aaron Saunders
  • 33,180
  • 5
  • 60
  • 80