<tfoot id='9K1yC'></tfoot>

  • <small id='9K1yC'></small><noframes id='9K1yC'>

    1. <legend id='9K1yC'><style id='9K1yC'><dir id='9K1yC'><q id='9K1yC'></q></dir></style></legend>

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

        UIGestureRecognizers (iPhone, Cocos2d) 的多种手势

        Multiple Gestures for UIGestureRecognizers (iPhone, Cocos2d)(UIGestureRecognizers (iPhone, Cocos2d) 的多种手势)
          <legend id='GE0re'><style id='GE0re'><dir id='GE0re'><q id='GE0re'></q></dir></style></legend>
        • <small id='GE0re'></small><noframes id='GE0re'>

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

                <tfoot id='GE0re'></tfoot>

                  <bdo id='GE0re'></bdo><ul id='GE0re'></ul>
                • 本文介绍了UIGestureRecognizers (iPhone, Cocos2d) 的多种手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Cocos2d 来渲染精灵,并使用 UIGestureRecognizers 来允许用户平移、旋转和缩放精灵.

                  I'm using Cocos2d to render a sprite, and UIGestureRecognizers to allow the user to Pan, Rotate and Scale the sprite.

                  我让每个人都使用如下代码单独工作:

                  I've got each working in isolation using code like the following:

                  UIPinchGestureRecognizer *pinchRecognizer = [[[UIPinchGestureRecognizer alloc] initWithTarget:layer action:@selector(handlePinchFrom:)] autorelease];
                  [viewController.view addGestureRecognizer:pinchRecognizer];
                  
                  UIRotationGestureRecognizer *rotationRecognizer = [[[UIRotationGestureRecognizer alloc] initWithTarget:layer action:@selector(handleRotationFrom:)] autorelease];
                  [viewController.view addGestureRecognizer:rotationRecognizer];
                  

                  但是,如果用户在旋转时将手指捏在一起,我想同时缩放和旋转精灵(例如,照片应用程序会这样做).不幸的是,识别器似乎陷入了旋转"或捏合"模式,并且不会同时调用两个处理程序:(

                  However, I want to both scale and rotate the sprite if the user pinches their fingers together whilst rotating (the Photos app does this, for instance). Unfortunately though, the recognizer seems to get stuck in either "rotate" or "pinch" mode, and won't call both handlers at the same time :(

                  所以,基本上,我想知道 - 这是否意味着我不能使用 UIGestureRecognizers?我可以组合两个识别器并在一个处理程序中执行所有操作吗?我是否必须将 UIGestureRecognizer 子类化为类似于PinchAndRotateRecognizer"的东西.

                  So, basically, I want to know - does this mean I can't use UIGestureRecognizers? Can I combine two recognizers and do all of the actions in a single handler? Will I have to subclass UIGestureRecognizer to be something like "PinchAndRotateRecognizer".

                  帮助表示赞赏:)

                  推荐答案

                  只需实现gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: 在您的委托中.

                  Just implement gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: in your delegate.

                  我设置了一个 UIPinchGestureRecognizer、一个 UIPanGestureRecognizer 和一个 UIRotationGestureRecognizer,我希望它们都能同时工作.我还有一个 UITapGestureRecognizer 我确实希望同时被识别.我所做的只是:

                  I have a UIPinchGestureRecognizer, a UIPanGestureRecognizer and a UIRotationGestureRecognizer set up and I want them all to work at the same time. I also have a UITapGestureRecognizer which I do not want to be recognized simultaneously. All I did was this:

                  - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
                  {
                      if (![gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] && ![otherGestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
                          return YES;
                      }
                  
                      return NO;
                  }
                  

                  这篇关于UIGestureRecognizers (iPhone, Cocos2d) 的多种手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Resume game cocos2d(恢复游戏 cocos2d)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)

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

                      <tbody id='iO8BG'></tbody>

                    <tfoot id='iO8BG'></tfoot>

                          <legend id='iO8BG'><style id='iO8BG'><dir id='iO8BG'><q id='iO8BG'></q></dir></style></legend>
                        1. <i id='iO8BG'><tr id='iO8BG'><dt id='iO8BG'><q id='iO8BG'><span id='iO8BG'><b id='iO8BG'><form id='iO8BG'><ins id='iO8BG'></ins><ul id='iO8BG'></ul><sub id='iO8BG'></sub></form><legend id='iO8BG'></legend><bdo id='iO8BG'><pre id='iO8BG'><center id='iO8BG'></center></pre></bdo></b><th id='iO8BG'></th></span></q></dt></tr></i><div id='iO8BG'><tfoot id='iO8BG'></tfoot><dl id='iO8BG'><fieldset id='iO8BG'></fieldset></dl></div>
                          • <bdo id='iO8BG'></bdo><ul id='iO8BG'></ul>