iphone – 我们如何使用Cocos2d显示UIViewController和UIView?

栏目: IOS · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/506680/how-we-can-show-uiviewcontroller-and-uiview-by-using-cocos2d

我正在尝试使用Cocos2d构建一个iPhone应用程序.但我使用了四种类型的类

像吼叫 –

@interface MenuScene : Scene {}

@end
@interface FlipView : UIImageView
{
    CGPoint startTouchPosition;
    NSString *dirString;
    UIImageView *firstPieceView;   
    UIImageView *secondPieceView;

}
@end

@interface HelloController : UIViewController
@end


@interface MenuLayer: Layer{
        Todo *todo;
        Menu * menu;
        sqlite3 *database;
        NSMutableArray *todos;
    NSString *dirString;
    CGPoint startTouchPosition;
}
@property (nonatomic, retain) NSMutableArray *todos;
-(void) button1: (id)sender;
-(void) button2: (id)sender;
-(void) black_jack: (id)sender;
@end

但是如何通过MenuLayer类显示FlipView和HelloController类.

如果您正在询问如何将UIKit视图等附加到cocos2d-iphone项目,您只需要这样做:

[[[Director sharedDirector] window] addSubview:myView];

更新到cocos 0.7,现在这是:

[[[Director sharedDirector] openGLView] addSubview:myView];

在科科斯0.99:

[[[CCDirector sharedDirector] openGLView] addSubview:myView];

在Cocos 2.0中

[[[CCDirector sharedDirector] view] addSubview:myView];

翻译自:https://stackoverflow.com/questions/506680/how-we-can-show-uiviewcontroller-and-uiview-by-using-cocos2d


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

用户体验草图设计

用户体验草图设计

比尔·巴克斯顿(Bill Buxton) / 黄峰 / 电子工业出版社 / 2009-11 / 168.00元

《用户体验草图设计:正确地设计,设计得正确(全彩)》:比尔·盖茨亲笔推荐版 人因国际、百度、华为、微软、腾讯用户体验部门联合推荐!一起来看看 《用户体验草图设计》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具