The process of creating an iPhone application in Visual Studio is very similar to that of Xamarin Studio. In this walkthrough, you will create a new application that will consist entirely of code. You will not be adding XIBs or storyboards and you will define your views programmatically by performing the following steps:
Open Visual Studio and create a new iOS solution using the iPhone Empty Project template.
Name your project
Visual Studio iOS Demo
and click the OK button.Add a new Empty class to your project.
Name the class
MyRootViewController
.Add a
using
statement for the MonoTouch.UIKit framework, as shown in the following line of code:Using MonoTouch.UIKit;
Set the class to inherit from
UIViewController
, as shown in the following code:classMyRootViewController : UIViewController { }
Override the
ViewDidLoad()
method:public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.LightGray; }
Open the
AppDelegate.cs
file...