c# xamarin_Xamarin Studio和Visual Studio在C#中进行iOS开发

c# xamarin

In the past, you may have considered Objective-C and iPhone development but the combination of a new architecture and a new programming language together may have been too much. Now with Xamarin Studio, and programming it in C#, you may find the architecture not that bad. You may end up coming back to Objective-C though Xamarin makes feasible any type of iOs programming including games.

过去,您可能曾经考虑过Objective-C和iPhone的开发,但是将新架构和新编程语言结合在一起的方法可能太多了。 现在使用Xamarin Studio,并用C#对其进行编程,您可能会发现该体系结构还不错。 尽管Xamarin使包括游戏在内的任何类型的iO编程都可行,但您最终可能会回到Objective-C。

This is the first of a set of tutorials on programming iOS Apps (ie both iPhone and iPad) and eventually Android Apps in C# using Xamarin Studio. So what is Xamarin Studio?

这是有关使用Xamarin Studio使用C#编程iOS应用程序(即iPhone和iPad)以及最终使用Android应用程序编程的一系列教程的第一篇。 那么什么是Xamarin Studio?

Previously known as MonoTouch Ios and MonoDroid (for Android), the Mac software is Xamarin Studio. This is an IDE that runs on Mac OS X and it's pretty good. If you've used MonoDevelop, then you'll be on familiar ground. It's not quite as good as Visual Studio in my opinion but that's a matter of taste and cost. Xamarin Studio is great for developing iOS Apps in C# and likely Android, though that depends on your experiences creating those.

Mac软件以前称为MonoTouch Ios和MonoDroid(适用于Android),是Xamarin Studio。 这是一个可以在Mac OS X上运行的IDE,非常好。 如果您使用过MonoDevelop,那么您将熟悉。 在我看来,它不像Visual Studio那样好,但这只是口味和成本的问题。 Xamarin Studio非常适合用C#和可能的Android开发iOS应用程序,尽管这取决于您创建这些应用程序的经验。

Xamarin版本 ( Xamarin Versions )

Xamarin Studio comes in four versions: There's the free one that can create Apps for the App store but those are limited to 32Kb in size which is not a lot! The other three cost starting with the Indie version for $299. On that, you develop on the Mac and can produce Apps of any size.

Xamarin Studio有四个版本:有一个免费版本,可以为App Store创建应用程序,但是大小限制为32Kb,这并不多! 其他三个版本的价格从Indie版本开始,为299美元。 在此基础上,您可以在Mac上进行开发,并且可以生成任何大小的应用。

Next is the Business version at $999 and that's the one used for these examples. As well as Xamarin Studio on the Mac it integrates with Visual Studio so you can develop iOS/Android apps as if writing .NET C#. The clever trick is that it uses your Mac to build and debug the App using the iPhone/iPad simulator while you step through code in Visual Studio.

接下来是商务版,价格为999美元,这是这些示例所使用的版本。 它与Mac上的Xamarin Studio一样,都与Visual Studio集成在一起,因此您可以像编写.NET C#一样开发iOS / Android应用。 聪明的窍门是,当您在Visual Studio中逐步执行代码时,它将使用Mac使用iPhone / iPad模拟器来构建和调试应用程序。

The big version is the Enterprise edition but that won't be covered here.

大版本是企业版,但此处不介绍。

In all four cases you need to own a Mac and to deploy Apps in the App store needs you to pay Apple $99 each year. You can manage to offset paying that until you need it, just develop against the iPhone simulator that comes with Xcode. You have to install Xcode but it's in the Mac Store and it's free.

在这四种情况下,您都需要拥有Mac并在App Store中部署Apps,您每年需要向Apple支付99美元。 您可以设法抵消付款,直到您需要它时,只需针对Xcode附带的iPhone模拟器进行开发即可。 您必须安装Xcode,但它在Mac Store中并且是免费的。

The Business edition does not have a big difference, just that it is on Windows instead of the Mac with free and Indie editions, and it uses the full power of Visual Studio (and Resharper). Part of that comes down to whether you prefer to develop Nibbed or Nibless?

商业版没有太大的区别,只是它在Windows上而不是在Mac上具有免费版和独立版,并且使用了Visual Studio(和Resharper)的全部功能。 部分原因取决于您是否喜欢开发Nibbed或Nibless?

bb或无Ni ( Nibbed or Nibless )

Xamarin integrates into Visual Studio as a plugin that gives new menu options. But it doesn't yet come with a designer like the Xcode's Interface Builder. If you are creating all your views ( the iOS word for controls) at runtime then you can run nibless. A nib (extension .xib) is an XML file that defines the controls etc in views and links events together so when you click on a control, it invokes a method.

Xamarin作为提供新菜单选项的插件集成到Visual Studio中。 但是它还没有像Xcode的Interface Builder这样的设计器附带。 如果要在运行时创建所有视图(iOS单词是“控件”),则可以运行nibless。 笔尖(扩展名.xib)是一个XML文件,用于在视图中定义控件等并将事件链接在一起,因此当您单击控件时,它会调用方法。

Xamarin Studio also requires you to use Interface Builder to create nibs but at the time of writing, they have a Visual designer running on the Mac in alpha state. It will likely become available on the PC as well.

Xamarin Studio还要求您使用Interface Builder创建笔尖,但在编写本文时,它们具有在Mac上以alpha状态运行的Visual设计器。 它也可能会在PC上可用。

Xamarin涵盖了整个iOS API ( Xamarin Covers the Whole iOS API )

The whole iOS API is pretty massive. Apple currently has 1705 documents in the iOS developer library covering all aspects of iOS development. Since they were last reviewed, the quality has improved a lot.

整个iOS API相当庞大。 苹果目前在iOS开发人员库中拥有1705个文档,涵盖了iOS开发的所有方面。 自从上次审核以来,质量已得到很大提高。

Likewise, the iOS API from Xamarin is pretty comprehensive, though you will find yourself referring back to the Apple docs.​

同样,尽管您会发现自己回头引用了Apple文档,但Xamarin的iOS API相当全面。

入门 ( Getting Started )

After installing Xamarin software on your Mac, create a new Solution. The project choices include iPad, iPhone, and Universal and also with Storyboards. For iPhone, you then have the choice of an Empty Project, Utility Application, Master-Detail Application, Single View application, Tabbed Application or OpenGl Application. You have similar choices for Mac and Android development.

在Mac上安装Xamarin软件后,创建一个新的解决方案。 项目选择包括iPad,iPhone和Universal,以及Storyboard。 对于iPhone,您可以选择“空项目”,“实用程序”应用程序,“主从应用程序”,“单视图”应用程序,“选项卡式”应用程序或“ OpenGl应用程序”。 对于Mac和Android开发,您有类似的选择。

Given the lack of designer on Visual Studio, you can take the nibless (Empty Project) route. It's not that difficult but nowhere as easy to get the design looking spot on. In this case, as you are mainly dealing with square buttons, it's not a worry.

鉴于Visual Studio缺少设计器,您可以采取无懈可击的方法(空项目)。 要使设计成为现实,并不是那么困难,但是没有那么容易。 在这种情况下,因为您主要处理方形按钮,所以不必担心。

架构iOS表单 ( Architecting iOS Forms )

You are entering into a world described by Views and ViewControllers and these are most important concepts to understand. A ViewController (of which there are several types) controls how data is displayed and manages view and resource management tasks. The actual displaying is done by a View (well a UIView descendant).

您正在进入一个由Views和ViewControllers描述的世界,这些是最重要的概念。 ViewController(有几种类型)控制数据的显示方式以及管理视图和资源管理任务。 实际的显示是通过View(以及UIView后代)完成的。

The User Interface is defined by ViewControllers working together. We'll see that in action in tutorial two with a simple nibless App like this one.

用户界面是由ViewController共同定义的。 在第二篇教程中,我们将看到一个像这样的简单无尖端应用程序的运行情况。

In the next tutorial, we'll look in depths at ViewControllers and develop the first complete App.

在下一个教程中,我们将深入研究ViewControllers并开发第一个完整的App。

翻译自: https://www.thoughtco.com/ios-development-xamarin-studio-visual-studio-958336

c# xamarin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于使用Visual Studio开发应用程序,你可以选择不同的开发方式和平台。下面是一些常见的开发选项: 1. .NET桌面应用程序开发:使用Visual Studio可以开发基于.NET框架的Windows桌面应用程序。你可以使用C#或VB.NET编程语言进行开发,并利用Visual Studio提供的工具和功能进行界面设计、调试和部署。 2. ASP.NET Web应用程序开发Visual Studio支持开发基于ASP.NET的Web应用程序。你可以使用C#或VB.NET编写服务器端代码,并使用HTML、CSS和JavaScript构建前端界面。Visual Studio提供了丰富的工具和模板,帮助你创建和发布Web应用程序。 3. 移动应用程序开发:使用Visual StudioXamarin,你可以开发跨平台的移动应用程序。Xamarin是一个基于.NET的移动应用程序开发框架,允许你使用C#编写代码,并将其部署到AndroidiOS设备上。Visual Studio提供了Xamarin的集成开发环境,方便你进行应用程序的开发、调试和测试。 4. Universal Windows Platform (UWP) 应用程序开发Visual Studio支持创建适用于Windows 10设备的UWP应用程序。你可以使用C#、VB.NET或C++编写代码,并利用Visual Studio的设计工具来创建响应式的界面和功能丰富的应用程序。 除了以上提到的开发选项,Visual Studio还提供了许多其他功能和工具,如数据库开发、云应用程序开发、游戏开发等。你可以根据自己的需求和技术背景选择适合的开发方式。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值