天天看點

.net程式員的iPhone開發-MonoTouch

iPhone軟體的Native開發除了使用Apple推薦的Objective-C  Cocoa之外,也有其他的一些工具和SDK提供

基于WEB的形式的一些架構在下面這個文章介紹過

<a href="http://www.cnblogs.com/2018/archive/2010/12/28/1918814.html">各種SmartPhone上的跨平台開源架構的總結</a>

<a href="http://www.cnblogs.com/2018/archive/2010/12/28/1918814.html">http://www.cnblogs.com/2018/archive/2010/12/28/1918814.html</a>

對于.net人員來說,使用C#語言也可以進行開發,這就是MonoTouch

2009年Novell開始的項目

通過MonoTouch,使用C#語言實作可以在iPhone上釋出和銷售的軟體

 1. Make sure you have your Intel Mac running at least version 10.5.7

  2. Download and install the Mono framework: www.go-mono.com/mono-downloads/download.html.

  3. Download and install MonoTouch: http://monotouch.net/

  4. Download and install MonoDevelop: http://monodevelop.com/Download

安裝好以上的工具後就可以使用MonoDevelop進行開發了

MonoTouch is made up of the following four components:

The  Monotouch.dll is a C# assembly that provides a binding API into the iPhone’s native APIs.

A command-line tool that compiles C# and Common Intermediate Language (CIL) code. This compiled code can then be run in the simulator or an actual iPhone.

An add-in to MonoDevelop that allows for iPhone development and for Interface Builder to create graphical applications.

A commercial license of the Mono runtime, which allows for the static linking of the Mono runtime with the code developed.

最常用的命名空間

MonoTouch.ObjCRuntime: This namespace provides the interop/bridge between the .NET/C# world and the Objective-C world of the iPhone.

MonoTouch.Foundation: This namespace provides support for the data types necessary to communicate with the Objective-C world of the iPhone. Most types are directly mapped. For example, the NSObject Objective-C base class is mapped to the MonoTouch.Foundation .NSObject class in C#. Some classes are not directly mapped and are instead mapped to their native .NET types. For example, NSString maps to the basic string type and NSArray maps to a strongly typed array.

MonoTouch.UIKit: This namespace provides a direct mapping between the UI components within Cocoa Touch. The mapping is done by providing .NET classes for each UI component, and this is the namespace that developers will likely spend most of their time working with. For .NET developers, Cocoa Touch is an abstraction layer or API for building programs that run in the iPhone. Cocoa Touch is based on the Cocoa API used in building programs that run on the Mac OS X operating system. Cocoa Touch can be thought of as Cocoa tuned for the touch-based iPhone operating system.

OpenTK: This namespace is a modified version of the OpenTK API. OpenTK is an objectoriented binding for OpenGL, which stands for the Open Graphics Library. OpenGL is an API for using three-dimensional graphics. OpenTK is a library for performing OpenGL, OpenAL, and OpenCL. It is written in C# and runs on Windows, Mac OS X, and Linux. The OpenTK implementation on the iPhone has been updated to use CoreGraphics and to only expose the functionality available on the iPhone.

繼續閱讀