I am trying to pass a String from an IBAction in my DetailsViewController to the viewDidLoad in my WebViewController to call up a URL in the WebView.
Does anybody know how I can do this?
My Code:
// DetailsViewController.m
- (IBAction)edu1Link:(id)sender {
NSString *webURL = [[NSString webURL] initWithString:@"http://www.apple.com"];
_webViewController = [[WebViewController alloc]
initWithNibName:@"WebViewController" bundle:nil];
[[self navigationController] presentModalViewController:_webViewController animated:YES];
}
// WebViewController.m
- (void)viewDidLoad
{
[_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:webURL]]];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
You could declare a property in your
WebViewControllerand set that property in the action before presenting the view controller.