没有合适的资源?快使用搜索试试~ 我知道了~
首页Xamarin开发这手册教程
资源详情
资源评论
资源推荐

Hello, Mac
Getting started with Xamarin.Mac development
Contents
This article will cover the following topics in detail:
Overview
Requirements
Starting a new Xamarin.Mac App in Visual Studio for Mac
Anatomy of a Xamarin.Mac Application
Main.cs
AppDelegate.cs
ViewController.cs
ViewController.Designer.cs
Info.plist
Introduction to Xcode and Interface Builder
Components of Xcode
Project Navigation
Interface Hierarchy
Interface Editor
Properties & Utilities
Creating the Interface
Outlets and Actions
Adding an Outlet
Adding an Action
Synchronizing Changes with Xcode
Writing the Code
Testing the Application
Building the Application
Running the Application
Where to Next
Overview

Xamarin.Mac allows for the development of fully native Mac apps in C# and .NET using the same OS X libraries
and interface controls that are used when developing in Objective-C and Xcode. Because Xamarin.Mac
integrates directly with Xcode, the developer can use Xcode's Interface Builder to create an app's User Interfaces
(or optionally create them directly in C# code).
Additionally, since Xamarin.Mac application are written in C# and .NET, common, backend code can be shared
with Xamarin.iOS and Xamarin.Android mobile apps; all while delivering a native experience on each platform.
This article will introduce the key concepts needed to create a Mac app using Xamarin.Mac, Visual Studio for
Mac and Xcode's Interface Builder by walking through the process of building a simply Hello, Mac app that
counts the number of times a button has been clicked:
The following concepts will be covered:
Visual Studio for Mac – Introduction to the Visual Studio for Mac and how to create Xamarin.Mac
applications with it.
Anatomy of a Xamarin.Mac Application – What a Xamarin.Mac application consists of.
Xcode’s Interface Builder – How to use Xcode’s Interface Builder to define an app’s User Interface.
Outlets and Actions – How to use Outlets and Actions to wire up controls in the User Interface.
Deployment/Testing – How to run and test a Xamarin.Mac app.
Requirements
The following is required to develop a macOS application with Xamarin.Mac:

A Mac computer running macOS Yosemite(10.10) or greater.
Xcode 7 and above (Although it is recommended to install the latest stable version from the App Store.)
Latest version of Xamarin.Mac and Visual Studio for Mac.
Running Mac applications created with Xamarin.Mac have the following system requirements:
A Mac computer running Mac OS X 10.7 or greater.
Starting a new Xamarin.Mac App in Visual Studio for
Mac
As stated above, this guide will walk through the steps to create a Mac app called Hello_Mac that adds a single
button and label to the main window. When the button is clicked, the label will display the number of times it has
been clicked.
To get started, do the following:
1. Start Visual Studio for Mac:
2. Click on the New Solution... link in the upper left hand corner of the screen to open the New Project
dialog box:

4. Enter Hello_Mac for the App Name, and keep everything else as default. Click Next:
5. When creating a solution that would house several different Projects, the developer might want to set a
different Solution Name here, but for the sake of this example, leave it set to the default of being the same
as the Project Name:
剩余34页未读,继续阅读












安全验证
文档复制为VIP权益,开通VIP直接复制

评论2