In this section, we will look at implementing the necessary logic in our ViewController class and learn how to work with the UITouch class to handle touch events to determine when a Game Tile has been tapped on the Game Board.
Let's start by modifying the ViewController class for our SlidingTiles app by performing the following steps:
- Ensure that the ViewController.cs file is currently displayed in the code editor.
- Next, underneath the startNewGame instance method, we need to create and implement an event method called TouchesEnded that will be called whenever a touch has happened in the game board view; enter the following code snippet:
#region 7 - Handling touch events in the Game ...