title: Xamarin iOS UIButton How To Click button programmatically?
body: <p>I'm attempting to fake the act of clicking a button, by programmatically calling it within my ViewWillAppear() function.</p>
  
  <p>The onclick function is defined in my ViewDidLoad(), and you can see I am trying to use a Perform Selector to manually call the button.</p>
  
  <p>The button does not appear to be running. Any ideas?</p>
  
  <pre><code>public override void ViewDidLoad()
  {
      base.ViewDidLoad();
  
      idButtonScanLoad.TouchUpInside += async (sender, ea) =&gt;
      {
          System.Console.WriteLine("Scan button pressed");
      };
  
  }
  
  [Export("TouchUpInsideEvent:")]
  private void TouchUpInsideEvent(NSObject sender)
  {
      Console.WriteLine("yay!");
  }
  
  public override void ViewWillAppear(bool animated)
  {
      base.ViewWillAppear(animated);
  
      this.PerformSelector(new ObjCRuntime.Selector("TouchUpInsideEvent:"), this as NSObject, 10f);
  }
  </code></pre>