title: how to change WebView with buttons in separate View Controller
body: <p>I need to change the URL of a WebView (located in WebViewViewController) using buttons in View Controller 1 (called PracticeViewController). I totally understand how to change the web View when it is in the same View Controller as the buttons, but I don't understand how to get the buttons to affect the WebView when the WebView is in a different ViewController than the buttons. Below is the code I currently have: </p>
  
  <pre><code>PracticeViewController.h
  
  #import &lt;UIKit/UIKit.h&gt;
  
  @interface PracticeViewController : UIViewController
  
  - (IBAction)passGoogleButton:(id)sender;
  
  - (IBAction)passYahooButton:(id)sender;
  
  - (IBAction)passBingButton:(id)sender;
  
  /* ok I tried to make this as clear as possible, and you can look at the other files if    you don't understand what I mean, but at its core I want to change the web site loaded by     the Web View by clicking on the buttons in the other View Controller */
  
  @end
  </code></pre>
  
  <p>space (BTW is there an easier way to post on StackOverFlow Besides pressing space 4 times for every line of code? am I missing something?)</p>
  
  <pre><code>PracticeViewController.m
  
   #import "PracticeViewController.h"
   #import "WebViewViewController.h"
  
  @interface PracticeViewController ()
  
  @end
  
  @implementation PracticeViewController
  
  - (void)viewDidLoad
  {
  [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  }
  
  - (void)didReceiveMemoryWarning
  {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)passGoogleButton:(id)sender {
  WebViewViewController.webSiteURL = @"http://www.google.com";
  
  /* This supposedly works on a tutorial I saw, but Xcode flags it with the error     'Property webSiteURL not found on object of type 'WebViewViewController'' */
  }
  
  - (IBAction)passYahooButton:(id)sender {
  WebViewViewController.webSiteURL = @"http://www.yahoo.com";
  //same error as above
  }
  
  - (IBAction)passBingButton:(id)sender {
  WebViewViewController.webSiteURL = @"http://www.bing.com";
  //same error as above
  }
  @end
  </code></pre>
  
  <p>space</p>
  
  <pre><code>WebViewViewController.h
  
  #import &lt;UIKit/UIKit.h&gt;
  
  @interface WebViewViewController : UIViewController
  {
  UIWebView *myWebView;
  NSString *webSiteURL;
  }
  @property (weak, nonatomic) IBOutlet UIWebView *myWebView;
  @property (strong, nonatomic) NSString *webSiteURL;
  
  /* I don't entirely understand what 'strong' means but I know it has to do with memory   retention and that it (supposedly) should be used when I wan to transfer the value of the   string 'webSiteURL' to the other ViewController */
  
  @end
  </code></pre>
  
  <p>space</p>
  
  <pre><code>WebViewViewController.m
  
  #import "WebViewViewController.h"
  
  @interface WebViewViewController ()
  
  @end
  
  @implementation WebViewViewController
  
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  if (self) {
      // Custom initialization
  }
  return self;
  }
  
  - (void)viewDidLoad
  {
  [super viewDidLoad];
  // Do any additional setup after loading the view.
  
  [myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:webSiteURL]]];
  
  /* As you can see above, the WebView loads from the string 'webSiteURL' but I can't figure out how to assign different values to it based on what button is clicked in the other View Controller so that it will run in ' - (void)viewDidLoad.' I already know how to transfer the value of the string to other things within another view controller (like into a label or a text field) but what I really need to know is how to get the string 'webSiteURL' to change before the view is loaded */
  
  }
  
  - (void)didReceiveMemoryWarning
  {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
  }
  
  @end
  </code></pre>