模态对话框的实现模板
来源:互联网 发布:单片机蜂鸣器发声程序 编辑:程序博客网 时间:2024/06/06 00:43
类从CCLayerColor继承
@interface LQModalLayer : CCLayerColor { }
@interface LQModalLayer () { // 模态对话框菜单 CCMenu *m_pMenu; // 记录菜单点击 bool m_bTouchedMenu;}
// 初始化数据-(id) init{ // always call "super" init // Apple recommends to re-assign "self" with the "super's" return value if( (self=[super initWithColor:ccc4(0, 0, 0, 125)]) ) { // ask director for the window size //CGSize size = [[CCDirector sharedDirector] winSize]; CCMenuItemSprite *testItem1 = [CCMenuItemSprite itemWithNormalSprite: [CCSprite spriteWithSpriteFrameName: @"btn3.png"] selectedSprite: [CCSprite spriteWithSpriteFrameName: @"btn3sel.png"] target: self selector: @selector(itemPressed:)]; testItem1.position = ccp(320,200); m_pMenu = [CCMenu menuWithItems: testItem1,nil]; m_pMenu.position = CGPointZero; m_pMenu.tag = 10; [self addChild:m_pMenu]; [self setIsTouchEnabled:YES]; } return self;}-(void) onEnter{ [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:kCCMenuHandlerPriority-1 swallowsTouches:YES]; [super onEnter];}- (void)onExit{ [[[CCDirector sharedDirector] touchDispatcher] removeDelegate:self]; [super onExit];}-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{// CGPoint point = [touch locationInView: [touch view]];// point = [[CCDirector sharedDirector] convertToGL: point]; m_bTouchedMenu = [m_pMenu ccTouchBegan:touch withEvent:event]; return YES;}-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event{ if (m_bTouchedMenu) { [m_pMenu ccTouchMoved:touch withEvent:event]; } return;}-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event{ if (m_bTouchedMenu) { [m_pMenu ccTouchEnded:touch withEvent:event]; m_bTouchedMenu = false; }}-(void) ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event{ if (m_bTouchedMenu) { [m_pMenu ccTouchCancelled:touch withEvent:event]; m_bTouchedMenu = false; }}- (void) itemPressed: (CCNode *) item{ NSLog(@"itemPressed...%@",item); [self setVisible:false]; [self.parent removeChild:self cleanup:true];}// 释放对象资源- (void) dealloc{ // in case you have something to dealloc, do it in this method // in this particular example nothing needs to be released. // cocos2d will automatically release all the children (Label) // don't forget to call "super dealloc" [super dealloc];}
- 模态对话框的实现模板
- js实现的简单模态对话框
- cocos2d-x 模态对话框的实现
- MFC 模态对话框的实现原理
- cocos2d-x 模态对话框的实现
- 模板配置对话框的创建
- JavaScript实现模态对话框
- iOS实现模态对话框
- JavaScript实现模态对话框
- Android的同步对话框(AlertDialog模态对话框返回值实现原理)
- css javascript div实现网页的模态对话框
- cocos2dx 弹出式模态对话框的实现与封装
- Cocos2d-js3.3 模态对话框的实现
- Cocos2d-JS 3.3 模态对话框的实现
- Cocos2dx 3.13 “模态对话框”的一种实现方式
- 对话框模板
- 浏览对话框的实现
- 实现对话框的伸缩
- 什么是DOM
- 等待一段时间
- 查找正在运行的进程
- ElasticSearch java API--创建mapping
- ASP.NET Web Forms 4.5的新特性
- 模态对话框的实现模板
- linux 应用程序设计基础--GDB调试
- flash中怎么制作一个按钮,当鼠标移上去就会显示文字(动态文本)?
- 每个程序员都必须遵守的编程原则
- VS 2010 在开发过程中碰到的问题整理
- 定时任务
- 三种常用数据库(Oracle、MySQL、SQLServer)的分页之SQLServer分页
- android Theme一览(Level为11以下)
- XML解析文章链接