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

  • Learning Xamarin Studio
  • William Smith
  • 189字
  • 2021-09-03 10:01:24

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.

主站蜘蛛池模板: 吉木乃县| 德江县| 中江县| 大姚县| 贵港市| 年辖:市辖区| 武平县| 库伦旗| 金湖县| 孟村| 茶陵县| 临清市| 新民市| 固始县| 安仁县| 宁阳县| 新乐市| 张家港市| 米易县| 昌宁县| 汾阳市| 台州市| 温州市| 卓资县| 林西县| 鸡东县| 元氏县| 秦安县| 定兴县| 册亨县| 聂荣县| 旬阳县| 封开县| 景德镇市| 邵阳县| 河津市| 华阴市| 青铜峡市| 中阳县| 奉化市| 镶黄旗|