In this section, we will look at implementing the CreateGameBoard instance method in our ViewController class. The CreateGameBoard instance method will be responsible for creating our game board and placing each of the tiles in our GameBoard View, using the GameTile class that we created previously.
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 ViewDidAppear method, we need to create a new instance method called CreateGameBoard that will be called whenever our view appears onscreen; enter the following code snippet: