创建一个跨平台的Windows,Mac OS X应用程序 [英] Create a cross platform Windows, Mac OS X application

查看:308
本文介绍了创建一个跨平台的Windows,Mac OS X应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个在Windows和Mac OS X上运行的应用程序。我也将$ b​​ $ b喜欢它利用它运行的平台上最好的框架,API等提供。有没有办法这样做而不必编写Objective-C代码,然后编写C#代码?我一直在想C ++作为一个选择,但我想知道是否还有其他东西。应用程序将基于GUI(虽然我不知道它将会做什么)

I would like to build an application that runs on both Windows and Mac OS X. I would also like it to leverage the best of what the platform it runs on has to offer with regards to Frameworks, API's etc. Is there a way to do this without having to write Objective-C code and then C# code? I've been thinking of C++ as an alternative but I was wondering if there was anything else out there. The app will be GUI based (though I don't know exactly what it will do yet)

-G。

推荐答案

很好,你早就想到了可移植性 - 事实后很难锁定。

It's good that you're thinking of portability early on - it's vastly more difficult to "bolt it on" after the fact.

有各种跨平台套件可用,但是IMHO都不足以在所有支持的平台上提供本地外观和感觉。在Mac上(我使用的),这些工具包的支持者总是想提到他们使用的是原生控件。这是一个好的开始,但它不是整个旅程。 Apple的人机接口指南处理的其他问题包括如何应该安排控件,如何按钮标签应该使用,应该使用什么标准快捷键等。

There are various cross-platform kits available, but IMHO all of them fall a bit short of providing a "native" look and feel on all the supported platforms. On the Mac (what I use), proponents of such kits always want to mention that they're using native controls. That's a good start, but it's not the whole journey. Other issues addressed by Apple's Human Interface Guidelines include how the controls should be arranged, how button labels should be phrased, what standard shortcut keys should be used, etc.

即使微软必须学习困难的方式关于尝试编写跨平台GUI的危险,对于Mac而言,这是一个错误的Word 6.0。

Even Microsoft had to learn the hard way about the dangers of trying to write a cross-platform GUI, with the ill-fated Word 6.0 for Mac.

IMHO,更好的方法是使用 MVC设计,使用标准的,便携式C ++编写的模型层,以及使用每个平台的本地工具包的视图和控制器层。对于Mac版本,Carbon和C ++过去是一个有趣的选项,现在不再支持,所以你想使用Cocoa,在视图中使用Objective-C,在控制器中使用Objective-C ++来弥合语言差距。您的Windows版本同样可以将模型编译为托管C ++,并使用任何.NET语言作为控制器和视图。

IMHO, a better approach is to use an MVC design, with the model layer written in standard, portable C++, and the view and controller layers using the native toolkit for each platform. For the Mac version, Carbon and C++ throughout used to be an interesting option that is now not supported anymore, so you would want to use Cocoa, using Objective-C in the view and Objective-C++ in your controllers to bridge the language gap. Your Windows version could likewise compile your model as "managed C++", and use any .NET language for controllers and views.

这篇关于创建一个跨平台的Windows,Mac OS X应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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