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

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

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

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

        第二次触摸动画

        时间:2023-07-07
        • <bdo id='aii74'></bdo><ul id='aii74'></ul>
            <tbody id='aii74'></tbody>

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

                1. <legend id='aii74'><style id='aii74'><dir id='aii74'><q id='aii74'></q></dir></style></legend>
                  <tfoot id='aii74'></tfoot>

                  <i id='aii74'><tr id='aii74'><dt id='aii74'><q id='aii74'><span id='aii74'><b id='aii74'><form id='aii74'><ins id='aii74'></ins><ul id='aii74'></ul><sub id='aii74'></sub></form><legend id='aii74'></legend><bdo id='aii74'><pre id='aii74'><center id='aii74'></center></pre></bdo></b><th id='aii74'></th></span></q></dt></tr></i><div id='aii74'><tfoot id='aii74'></tfoot><dl id='aii74'><fieldset id='aii74'></fieldset></dl></div>
                2. 本文介绍了第二次触摸动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  尝试掌握 Xcode 并在过去几周似乎取得了一些进展.

                  Trying to get to grips with Xcode and seem to be making some progress over the last few weeks.

                  有谁知道自定义按钮可以在第二次点击时执行一组不同的动画.

                  Does anyone know a way that a custom button can do a different set of animations on a second click.

                  假设我有一个自定义按钮及其马里奥,当我点击它时,他从屏幕中间跑出屏幕右侧,然后从左侧跑回中间屏幕上,他也会发出声音.

                  So let say I have a custom button and its of Mario, when i click it he runs from the middle of the screen and out of the right hand side of the screen and then runs back in to the middle from the left of the screen, he also makes noise.

                  我使用以下代码实现了这一点:

                  I have achieved this using this code:

                  - (IBAction)marioRunning_clicked:(id)sender
                  {
                  
                      [UIView animateWithDuration:1.50 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
                          marioRunning.center = CGPointMake(350.5, 456.0);
                      } completion:^(BOOL finished) {
                          if (finished) {
                              [UIView animateWithDuration:0.00 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
                                  marioRunning.center = CGPointMake(-30.5, 456.0);
                              } completion:^(BOOL finished) {
                                  if (finished) {
                                      [UIView animateWithDuration:1.50 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
                                          marioRunning.center = CGPointMake(160.0, 456.0);
                                      } completion:^(BOOL finished) {
                                          if(finished)  // NSLog ( @"Finished !!!!!" );
                                          marioRunning.center = CGPointMake(160.0, 456.0);
                                      }];
                                  }
                              }];
                          }
                      }];
                  
                      marioRunning.imageView.animationImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"mario-running2"],[UIImage imageNamed:@"mario-running3"],nil];
                  
                      marioRunning.imageView.animationDuration = 0.15;
                      marioRunning.imageView.animationRepeatCount = 19;
                  
                      [marioRunning.imageView startAnimating];
                  }
                  

                  我怎样才能让他在下次点击时制作第二组动画?例如,如果我第二次点击他,而不是从左到右运行,他会上下跳跃?

                  How could I make him do a second set of animations on the next click? For example instead of running from left to right, if i tap him the second time he will Jump up and down?

                  推荐答案

                  使用按钮的选中状态来决定做哪个动画

                  Use the selected state of the button to decide which animation to do

                  -(void)buttonClicked:(UIButton*)button
                  {
                       if(button.selected)
                       {
                            [self doAnimation1];
                       }
                       else
                       {
                            [self doAnimation2];
                       }
                  
                       button.selected = !button.selected;
                  }
                  

                  这篇关于第二次触摸动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何随机放置 UIButton 和值 下一篇:如何限制按钮点击

                  相关文章

                        <bdo id='4x5vd'></bdo><ul id='4x5vd'></ul>

                      <tfoot id='4x5vd'></tfoot>

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

                      <small id='4x5vd'></small><noframes id='4x5vd'>

                      <legend id='4x5vd'><style id='4x5vd'><dir id='4x5vd'><q id='4x5vd'></q></dir></style></legend>