如何使代码可移植?
我正在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否见过 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.
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.