One of the most used views of an app's design is the Button view. A Button  view has control events, that is that when a user interacts with it, the view can trigger actions. Let's learn how!

  • To start with let's add our Button! We will set its background color to black, and leave the View's background color to white, and set its Visible in Code to true.
  • Now let's go to Editor Code and add a function named "buttonAction".  We will implement it so that when it is triggered it changes the View's background color to black.
  • Now, all we have to do is "connect" the Button view to the "buttonAction". Let's go back to the Design screen, and press the events tab. 
  • Press the "+" button of the "Touch up inside" event and select the "buttonAction" function. In theory, the button action should work, but let's check it.

Press "Test app" and run the app.

 Now tap on the button.

The background color changed, so the action was successfully triggered! That's all folks!

Did this answer your question?