有没有办法混合MonoTouch和Objective-C? [英] Is there a way to mix MonoTouch and Objective-C?

查看:85
本文介绍了有没有办法混合MonoTouch和Objective-C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以在一个项目中混合使用C#和Obj-C代码.具体来说,我想在Cos2D的Obj-C中使用Cocos2D,并调用一些MonoTouch C#-Library,它可以进行一些计算并取回一些值.有没有办法做到这一点?或许反过来说,我. e.在MonoTouch中构建并调用Cocos2D函数? 谢谢.

I'd like to know if there is a way to mix C# and Obj-C code in one project. Specifically, I'd like to use Cocos2D for my UI in Obj-C and call some MonoTouch C#-Library that does some computations and get some values back. Is there a way to do this? Or maybe the other way around, i. e. building in MonoTouch and calling Cocos2D-functions? Thanks.

推荐答案

您描述的设置是可能的,但是管道不如在MonoTouch中完成整个项目时的平滑.实际上,这就是我们引导MonoTouch的方式:我们获取了一个现有的Objective-C示例,然后用托管代码逐位替换了这些位.

The setup that you describe is possible, but the pipeline is not as smooth as it is when you do your entire project in MonoTouch. This is in fact how we bootstrapped MonoTouch: we took an existing Objective-C sample and we then replaced the bits one by one with managed code.

我们把那些样品腐烂掉了.

We dropped those samples as they bitrot.

但是您仍然可以完成此操作,使用mtouch的--xcode命令行选项为您生成示例程序,然后将所需的位从生成的template.m复制到main.m中.自定义所需的组件,然后从此处启动XCode项目.

But you can still get this done, use the mtouch's --xcode command line option to generate a sample program for you, and then copy the bits that you want from the generated template.m into your main.m. Customize the components that you want, and just start the XCode project from there.

在开发周期中,您将继续使用mtouch --xcode

During your development cycle, you will continue to use mtouch --xcode

这篇关于有没有办法混合MonoTouch和Objective-C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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