• <legend id='V0W4e'><style id='V0W4e'><dir id='V0W4e'><q id='V0W4e'></q></dir></style></legend>

  • <small id='V0W4e'></small><noframes id='V0W4e'>

      <bdo id='V0W4e'></bdo><ul id='V0W4e'></ul>
    <tfoot id='V0W4e'></tfoot>

        <i id='V0W4e'><tr id='V0W4e'><dt id='V0W4e'><q id='V0W4e'><span id='V0W4e'><b id='V0W4e'><form id='V0W4e'><ins id='V0W4e'></ins><ul id='V0W4e'></ul><sub id='V0W4e'></sub></form><legend id='V0W4e'></legend><bdo id='V0W4e'><pre id='V0W4e'><center id='V0W4e'></center></pre></bdo></b><th id='V0W4e'></th></span></q></dt></tr></i><div id='V0W4e'><tfoot id='V0W4e'></tfoot><dl id='V0W4e'><fieldset id='V0W4e'></fieldset></dl></div>

        如何在 cocos2d 中以编程方式创建新的 UIView?

        How to create a new UIView programmatically in cocos2d?(如何在 cocos2d 中以编程方式创建新的 UIView?)

          <small id='ThCdG'></small><noframes id='ThCdG'>

          • <bdo id='ThCdG'></bdo><ul id='ThCdG'></ul>
                <tbody id='ThCdG'></tbody>

                  <tfoot id='ThCdG'></tfoot>
                  <legend id='ThCdG'><style id='ThCdG'><dir id='ThCdG'><q id='ThCdG'></q></dir></style></legend>

                  <i id='ThCdG'><tr id='ThCdG'><dt id='ThCdG'><q id='ThCdG'><span id='ThCdG'><b id='ThCdG'><form id='ThCdG'><ins id='ThCdG'></ins><ul id='ThCdG'></ul><sub id='ThCdG'></sub></form><legend id='ThCdG'></legend><bdo id='ThCdG'><pre id='ThCdG'><center id='ThCdG'></center></pre></bdo></b><th id='ThCdG'></th></span></q></dt></tr></i><div id='ThCdG'><tfoot id='ThCdG'></tfoot><dl id='ThCdG'><fieldset id='ThCdG'></fieldset></dl></div>
                1. 本文介绍了如何在 cocos2d 中以编程方式创建新的 UIView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在 cocos2d 中以编程方式在按钮单击时创建一个新的 UIView.请帮助我提供一些示例代码.提前致谢.

                  I want to create a new UIView on button click programmatically in cocos2d. Kindly help me with some sample code. Thanks in advance.

                  推荐答案

                  你必须创建一个类似的按钮-

                  You have to create a button like-

                  UIButton* myButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  myButton.frame = CGRectMake(30, 70,100,38); //set frame for button
                  
                  [myButton setTitle:@"subview" forState:UIControlStateNormal];
                  [myButton addTarget:self action:@selector(buttonClicked:)forControlEvents:UIControlEventTouchUpInside];
                  

                  或者您可以使用 CCMenu 作为按钮.

                  Or you can use CCMenu as a button.

                  然后编写事件处理函数-

                  And then write the event handling function-

                  -(void)buttonClicked:(id)sender
                  {
                          UIView *myview=[[UIView alloc] initWithFrame: CGRectMake(0, 0,320,480)];
                          myview.backgroundColor=[UIColor redColor];
                          [[[CCDirector sharedDirector] openGLView] addSubview:myview];
                          [myview release];                   
                  }
                  

                  }

                  这篇关于如何在 cocos2d 中以编程方式创建新的 UIView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                  <legend id='CtSIl'><style id='CtSIl'><dir id='CtSIl'><q id='CtSIl'></q></dir></style></legend>

                      <tfoot id='CtSIl'></tfoot>

                        • <bdo id='CtSIl'></bdo><ul id='CtSIl'></ul>

                          <i id='CtSIl'><tr id='CtSIl'><dt id='CtSIl'><q id='CtSIl'><span id='CtSIl'><b id='CtSIl'><form id='CtSIl'><ins id='CtSIl'></ins><ul id='CtSIl'></ul><sub id='CtSIl'></sub></form><legend id='CtSIl'></legend><bdo id='CtSIl'><pre id='CtSIl'><center id='CtSIl'></center></pre></bdo></b><th id='CtSIl'></th></span></q></dt></tr></i><div id='CtSIl'><tfoot id='CtSIl'></tfoot><dl id='CtSIl'><fieldset id='CtSIl'></fieldset></dl></div>
                            <tbody id='CtSIl'></tbody>
                        • <small id='CtSIl'></small><noframes id='CtSIl'>