Take a Look at Your First App
Before we go into the coding part, let’s first take a look at our version of the “Hello World” app. The final deliverable will look like this
From the New Solution Dialogue, we’ll choose C# > iOS > Unified API > iPhone > Single View Application template. Let’s give it the Name Hello_world, and the Solution Name Hello_world:
Next, we’ll open the MainStoryboard.storyboard file by double-clicking on it in the Solution pad:
From the Toolbox (the area on the right), let’s type “Button” into the search bar and drag a Button onto the design surface (the area in the center)
With the Button selected on the design surface, change the Name property in the Identity section of the Property Pad to btn_. Change the Title property to “Click Here”:
Next, grab the handles of the Dragging Controls (the circles around the control) and make the button wider:
Now go to Event tag in button property and write event name in Up Side property. This is the method or event name that has the code that you want to execute when button will press.
Next we’re going to add code to wire up the user interface. Let’s add the code to power the user interface into the Hello_WorldViewController class. Double-click on Hello_WorldViewController.cs in the Solution Pad to open it.
You will find btn_click event
partial void btn_click(UIButton sender)
var av= new UIAlertView(“Hello”,
Just write above code into btn_click event to prompt alertview and that’s it.
Let’s save our work, and then build the application by choosing Build=>Build All. If our application compiles, we will get a success message at the top of the IDE:
If there are errors, we can go through the previous steps and correct any mistakes until the application builds successfully.
Finally, let’s test our application in the iOS Simulator. In the top left of the IDE, choose Debug from the first dropdown, and iPhone from second dropdown, and press Start (the round button that resembles a Play button):
This will launch our application inside the iOS Simulator:
If you like this tutorial then you can download full copy of the code from github.