我应该是什么约束上认识到最大限度地单代码的可移植性? [英] What contraints should I be aware of to maximize portability of Mono code?

查看:140
本文介绍了我应该是什么约束上认识到最大限度地单代码的可移植性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的书面使用单一些跨平台的代码,以针对移动iOS和Android运行时。

I'm interested in writing some cross-platform code using Mono, with a view to targeting mobile iOS and Android runtimes.

我已经详细阅读了单声道和MonoTouch的网站,但没有看到任何专门负责就方法不使用,否则应避免的单挂钩。然而,这似乎有点过于异想天开。

I've perused the Mono and MonoTouch sites, but don't see anything that specifically advises on methods not to use, or Mono hooks which should be avoided. However, that seems a little too good to be true.

我应该知道进入这个项目,以确保代码的最大的可移植性什么限制?

What limitations should I be aware of going into this project, to ensure maximum portability of the code?

推荐答案

API聪明的你会得到一个非常类似的基类库(BCL)使用MonoTouch的或黑白为Android时( M4A),因为两者共享同一的移动的最初是基于Silverlight的形象和增强,可以使用更多的FX 4.0 API)的个人资料(。

API wise you get a very similar base class libraries (BCL) when using MonoTouch or Mono for Android (M4A) since both share the same mobile profile (which was originally based on the Silverlight profile and enhanced to use more FX 4.0 API).

这是一个很大的公共代码。在BCL差别很小,但有的存在,主要是因为上运行的 iOS版设备需要一些妥协,这带来了一些的限制的。

That's a lot of common code. Differences in the BCL are minimal but some do exists, mostly because running on iOS devices requires some compromises, which creates some limitations.

BCL 的MonoTouch和M4A都提供了绑定自己的平台。例如。 MonoTouch的提供monotouch.dll结合大部分(基于C语言或基于ObjectiveC)的iOS API的。 Android的那部分将无法在单工作(和相同的是该M4A提供了Android绑定真)。

Outside the BCL both MonoTouch and M4A provides bindings for their platform. E.g. MonoTouch provides monotouch.dll which binds most of the iOS (C-based or ObjectiveC-based) API. That part won't work on Mono for Android (and the same is true for the Android bindings that M4A provides).

这就是你需要拿出一个设计以最小化的差异。在许多情况下,大多数的不同的的方面是在用户界面并有几个办法,很多都是基于MVC(如的 MonoCross ),以使这更容易的开发上,同时实现本机的外观和感觉为每个平台。

That's where you need to come up with a design to minimize the differences. In many cases the most different aspect is the user interfaces and there are a few approaches, many of them are based on MVC (e.g. MonoCross) to make this easier on developers while enabling a native look-and-feel for every platform.

这篇关于我应该是什么约束上认识到最大限度地单代码的可移植性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆