在iOS和Mac OS X应用程序中使用C ++ [英] Utilizing C++ in iOS and Mac OS X applications

查看:161
本文介绍了在iOS和Mac OS X应用程序中使用C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点温和在我的C ++知识,但知道旁边没有Objective-C。我计划(甚至开始)学习Objective-C,所以我可以尝试写几个iOS甚至Mac OS X应用程序,但我很好奇我还没有找到的东西。

I'm somewhat moderate in my C++ knowledge but know next to nothing regarding Objective-C. I am planning (and even starting to) learn Objective-C so I can attempt to write a few iOS and even Mac OS X applications but I'm very curious about something I haven't been able to find yet.

是否可以使用C ++(包括UI组件)完全编写iOS和/或Mac OS X应用程序?如果不可能完全在C + +然后到什么程度可以使用大多数C ++?

Is it possible to write an iOS and / or a Mac OS X application entirely with C++ including the UI components? If it isn't possible to do it entirely in C++ then to what degree is it possible to use mostly C++?

我没有看到任何示例,这些项目。我计划为iOS和Android编写几个移动应用程序,并且在可能的情况下,我想在C ++代码中包含我的大部分逻辑,以实现最大的可移植性。

I haven't seen any examples that demonstrate either of these items. I am planning on writing a few mobile applications for iOS and Android and, where possible, I'd like to contain most of my logic inside of C++ code for maximum portability. I already know I can do this but I am unsure of the degree.

推荐答案

简单的答案,是的。

对于纯C ++,您应该查看 QT框架。 >
否则,你的UI部分会很难。

For pure C++, you should take a look at the QT framework.
Otherwise, you'll have hard time for the UI part.

但是请记住Objective-C可以和C ++混合使用。

这叫 Objective-C ++ (.mm文件)。

But also remember that Objective-C can be mixed with C++.
That's called Objective-C++ (.mm files).

然后你可以编写混合C ++和Objective-C代码。
这样,你可以在Objective-C中使用UI部分(可能更好,因为它将使用UI组件的本地框架)和C ++中的其他东西。

You can then write code that mix C++ and Objective-C code. With this, you can have the UI parts in Objective-C (may be better, as it will use the native frameworks for the UI components), and the other things in C++.

如果你已经决定学习Objective-C,但是仍然希望在C ++中为某些部分编码,我会推荐这种方法,而不是纯C ++。

If you've decided to learn Objective-C, but still want to code in C++ for some parts, I would recommend this approach, instead of pure C++.

iOS 上,这也是唯一的方法。虽然您可以使用C ++代码,但您必须为UI部分使用Objective-C。

On iOS, this is also the only way. While you can code in C++, you have to use Objective-C for the UI part.

EDIT

以下是一些开始使用Objective-C ++的链接:

Here are a few links to get started with Objective-C++:

  • Strategies for Using C++ in Objective-C Projects
  • From C++ to Objective-C
  • CocoaDev

这篇关于在iOS和Mac OS X应用程序中使用C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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