官术网_书友最值得收藏!

Creating your first iOS application

Creating your first iOS application with Xamarin Studio is remarkably easy. For now, let's just build a simple project as a point of reference, as shown in the following steps. We'll dig into the details later.

  1. Within Xamarin Studio, navigate to File | New | Solution….
  2. Choose the C# | iOS | iPhone group.
  3. Choose the Single View Application project type.
  4. Name your project HelloiPhone and click OK.
  5. Open the HelloiPhoneViewController.cs file.
  6. We'll explore some code examples in detail later, but for now just replace the ViewDidLoad() method with the following block of code:
    UILabellabelHello;
    public override void ViewDidLoad ()
            {
    base.ViewDidLoad ();
    var frame = new RectangleF(10, 10, 300, 30);
    labelHello = new UILabel(frame);
    labelHello.Text = "Hello, iPhone!";
    View.Add (labelHello);
            }
  7. In the target dropdown, select iPhone Retina (4-inch) -> iOS 7.1.
  8. Click the Build and Run button.

That's it! You've created your first iOS application using Xamarin Studio! Yes it's merely a simple Hello World variation, but this application proves that your environment is properly configured (assuming it ran, of course) and gives us an iOS context to work within.

主站蜘蛛池模板: 龙陵县| 阿鲁科尔沁旗| 乐都县| 江北区| 松江区| 乐都县| 侯马市| 濮阳县| 芒康县| 调兵山市| 华蓥市| 玉田县| 义乌市| 永平县| 商都县| 大余县| 平和县| 济源市| 白河县| 苏尼特左旗| 商城县| 丽江市| 镇安县| 文山县| 长沙市| 资兴市| 南康市| 遂昌县| 抚远县| 宁夏| 青龙| 庄浪县| 华阴市| 沙田区| 冷水江市| 上高县| 佛学| 通渭县| 怀集县| 闵行区| 开江县|