If you are familiar with developing applications using Visual Studio on Windows, then using Xamarin Studio should be very straightforward. Xamarin uses the same concept of a solution that contains one or more projects, and there are now several new project types for iOS and Android applications. There are also several project templates to jumpstart your development of common applications.
Xamarin Studio supports several out of the box project types including standard .NET
class libraries and console applications. You cannot natively develop Windows applications on a Mac with Xamarin Studio, but you can certainly develop the shared code portion of your application in Xamarin Studio. We'll elaborate on sharing code in the later chapters, but keep in mind that Xamarin enables you to share a common C# backend between nearly any platforms that support C#.
In this chapter, we will cover:
Launch Xamarin Studio and start a new solution. Just like in Visual Studio, there are lots of project types that can be created from the New Solution dialog. Xamarin Studio, formerly MonoDevelop, supports the development of many different types of projects such as C# console applications targeting the Mono runtime, NUnit test projects, and even other languages besides C#, such as VB or C++.
Xamarin Studio supports the following project types for iOS:
To get started, navigate to iOS | iPhone Storyboard and, create a Single View Application in the directory of your choice, as seen in the following screenshot.
You'll notice that several files and folders are automatically created from the project template. These files are as follows:
Resources
: This directory will contain any images or plain files that you want to be copied directly to your application bundle.AppDelegate.cs
: This is Apple's main class that handles application-level events in your app.*ViewController.cs
: This is the controller that represents the first screen in your app. It will have the same name as your project.Info.plist
: This is Apple's version of a manifest file that can declare various settings for your application.Main.cs
: This file contains the standard entry point for a C# program: static void Main()
. It's most likely that you will not need to modify this file.MainStoryboard.storyboard
: This is the storyboard definition file for your application. It will contain the layouts for the views in your app, list of controllers, and the transitions for navigating throughout your app.Now, let's run the application to see what we get by default from the project template. Click on the large play button in the top-left corner of Xamarin Studio. You will be greeted by the simulator running your first iOS application as seen in the following screenshot:
So far, your app is just a plain white screen, which is not very exciting; but, let's get a little more background on iOS development before moving forward.
Depending on your application's minimum iOS target, you can also run the application on an iOS 6 or iOS 7 simulator. Apple also provides simulators for iPad and different devices such as the iPad, iPhone 4, and iPhone 5. It is also important to know that these are simulators and not emulators. An emulator will run an encapsulated version of the mobile OS (just as Android does). Emulators generally exhibit slower performance but give you a closer replica of the real OS. Apple's simulators run in native Mac applications and are not true operating systems. The benefit is that they are very fast in comparison to Android emulators.
3.15.235.196