关于在iPhone上合并2个应用程序(App)成一个
这次需要做一个把2个iphone游戏合成一个的事情,一开始还没有头绪,所以去论坛上求助高手。
回顾下其他平台的做法:
Brew平台:可以多个应用程序(app)在一起的,每个app有一个单独的classiD,你通过系统提供的startapplet就可以启动其他的app,包括可以后台运行,退出自己,都比较容易。
J2ME平台:我记得一个midlet suit里是包含多个midlet的,应该可以分别启动,我记得我当初做的一款合集是通过切换canvas来实现的。
最后到iPhone: 根据论坛上的官方回答(PS:看来iPhone的客户也还可以,以前去Brew论坛提问的时候官方技术人员也会回家,J2ME我就没试过,因为中文资料很多。),iPhone只能同时跑起一个应用程序,所以我这种想法是不可行了,
所以,在iPhone上想原封不动合成2个app是不可能的,必须要采取原始的办法,如下:
1,新建一个工程,使用自己的view,弄个界面先显示选择进入哪个app,
2,把那2个app的代码和资源都合到新的工程里,但是可以各自用各自的文件夹
3,这里也不是完全合成,每个app还是各自的view,消息从主工程里传进去,
主框架负责在3个view之前切换,当切换到各个app的时候,把消息传过去。
转载请保留以下信息:
作者(Author):smilelance
时间( Time ):2010.01
出处( From ):http://blog.csdn.net/smilelance
把我官网提问的帖子粘贴上来,防止以后再去找了:
How to bundle two App in one Package?
Jan 27, 2010 6:52 PM
Official Reply:
You're not going to solve this problem as you've stated it. iPhone OS applications are not allowed to load code, so there's no way that C can launch A (or B).
Probably the best solution would be to take A and B, factor out their guts, and roll them together with C as a wrapper around them. You have a single application CAB which contains all of the code, and at launch you use a thin UI to choose which section of the application to run.
If you do this, make sure you do it at the view controller level. Don't try and have each application create its own UIApplication object; that way lies madness. Rather, extract the relevant view controllers from A, B and C and host them all within a single UIApplication object.
Share and Enjoy
--
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
< http://www.apple.com/developer/ >
< http://www.lists.apple.com/macnetworkprog/ >
< http://www.lists.apple.com/mailman/listinfo/filesystem-dev >