title: UIWebView path depends on previous pressed button Xcode
body: <p>I have a <code>ViewController (A)</code>, containing n buttons. all buttons map to other <code>ViewController(B)</code> containing a <code>WebView</code> to show a different PDF.</p>
  
  <p>Instead of creating n <code>ViewController</code>, I would know how to change path according to which button was pressed.</p>
  
  <hr>
  
  <p>my wrong tries:</p>
  
  <p>1- use tags of buttons in ClassB <code>viewDidLoad:(id)</code> sender (I add sender)</p>
  
  <pre><code>([sender tag] == 1)
  //Action
  </code></pre>
  
  <p>2- access public variable from other class</p>
  
  <p>in class A.h</p>
  
  <pre><code>@interface ClassA : UIViewController
  {
      @public
      NSString *path;//was var
  }
  @property (readwrite, nonatomic) NSString* path;
  </code></pre>
  
  <p>ClassA.m</p>
  
  <pre><code>- (IBAction)button1:(UIButton *)sender{
      path=[[NSBundle mainBundle]
                      pathForResource:@"filename" ofType:@"pdf"];
  }
  </code></pre>
  
  <p>in class B:</p>
  
  <pre><code>ClassB *obj ;
  NSURL *url= [NSURL fileURLWithPath:obj-&gt;path];
  NSURLRequest *request=[NSURLRequest requestWithURL:url];
  [_webview loadRequest:request];
  [_webview setScalesPageToFit:YES];
  </code></pre>