cg1991 cg1991 - 6 months ago 35
iOS Question

Xamarin IOS Button ID where to find

I need some help on find the button in ViewController. enter image description here

As you can see in the image the Hello World is the default button in the screen. However, I cannot understand how did the code connect to that button.enter image description here
As I tried to click on that Button, it does not show any related have name or identity. May I know how or where is the Button linked or called?

Answer Source

enter image description here

Click the Button on your storyboard, Open the Properties View (View > Pads > Properties). Give the button a name. That's it, Xamarin studio will create the required outlets.

Now if you open the ViewController.designer.cs file. You can see outlets are created. You'll find the below code in your ViewController.designer.cs

[Outlet]
UIKit.UIButton Button { get; set; }

void ReleaseDesignerOutlets ()
{
    if (Button != null) {
        Button.Dispose ();
        Button = null;
    }
}