Book Image

Learning Xamarin studio

By : William Smith
Book Image

Learning Xamarin studio

By: William Smith

Overview of this book

Table of Contents (16 chapters)
Learning Xamarin Studio
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating an iPhone application in Visual Studio


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:

  1. Open Visual Studio and create a new iOS solution using the iPhone Empty Project template.

  2. Name your project Visual Studio iOS Demo and click the OK button.

  3. Add a new Empty class to your project.

  4. Name the class MyRootViewController.

  5. Add a using statement for the MonoTouch.UIKit framework, as shown in the following line of code:

    Using MonoTouch.UIKit;
  6. Set the class to inherit from UIViewController, as shown in the following code:

    classMyRootViewController : UIViewController
    {
    }
  7. Override the ViewDidLoad() method:

    public override void ViewDidLoad()
    {
    base.ViewDidLoad();
    View.BackgroundColor = UIColor.LightGray;
    }
  8. Open the AppDelegate.cs file...