如何使代码可移植?

发布于 2024-11-19 11:33:24 字数 89 浏览 3 评论 0原文

我正在Android上开发一个应用程序,该应用程序将在IOS上传输。

我的问题很简单:如何制作可移植的代码?是否有规则可以简化另一种语言的代码复制?

I am developing an application on Android and this application will be transported on IOS.

My question is simple: how can I make a transportable code? Are there rules to simplify the copy of the code in another language?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半山落雨半山空 2024-11-26 11:33:25

您是否见过 java2objc - 将 Java 代码转换为 ObjC 代码的工具。

您还可以尝试 MonoTouch(适用于 iPhone)和 MonoDroid(适用于 Android)等工具,它们允许您在 .NET 中进行开发。

Have you seen java2objc - a tool to convert Java code to ObjC code.

You can also try something like MonoTouch (for iPhone) and MonoDroid (for Android), which allows you to develop in .NET.

心安伴我暖 2024-11-26 11:33:25

iOS 应用程序大部分是用 Objective-C 编写的。 Android 应用程序大部分是用 Java 编写的。您无法将代码复制为另一种语言。您必须手动将 Android Java 代码移植到 Objective-C/Cocoa-touch。如果您的 Android 应用程序是基于 Web 的,您可以简单地在 Web 视图中重复使用相同的 HTML。 iOS 和 Android 应用程序的工作方式不同,用户期望不同的体验,因此了解这些差异将有助于您创建易于移植的代码。

iOS applications are mostly written in Objective-C. Android applications are mostly written in Java. You can't copy the code into another language. You must port your Android Java code manually to Objective-C/Cocoa-touch. If your Android application is web based, you can simply re-use the same HTML in a webview. iOS and Android apps work differently and users expect a different experience, so understanding the differences will help you in creating easily ported code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文