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

    <legend id='b9kgV'><style id='b9kgV'><dir id='b9kgV'><q id='b9kgV'></q></dir></style></legend>

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

      如何创建多阶段 UIImageView 动画?

      How to create a multistage UIImageView animation?(如何创建多阶段 UIImageView 动画?)
          <tbody id='ifHrq'></tbody>
        • <tfoot id='ifHrq'></tfoot>

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

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

              • <bdo id='ifHrq'></bdo><ul id='ifHrq'></ul>
                本文介绍了如何创建多阶段 UIImageView 动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试制作多阶段动画,以便 UIImageView (1) 淡入,(2) 移动,(3) 滑出屏幕.

                I'm trying to do a multistage animation, so that a UIImageView (1) fades in, (2) moves, (3) slide off the screen.

                似乎只有第 1 阶段有效.我究竟做错了什么?代码如下:

                Only stage 1 seems to work. What am I doing wrong? Here's the code:

                // FIRST PART - FADE IN
                -(void)firstAnim
                {
                    // 'sprite' is a UIImageView
                    [sprite setAlpha:0.1f];
                    [UIView beginAnimations:@"anim1" context:NULL];
                    [UIView setAnimationBeginsFromCurrentState:YES];
                    [UIView setAnimationDuration:0.25];
                    [UIView setAnimationDidStopSelector:@selector(secondAnim)];
                    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
                    [sprite setAlpha:1.0f];
                    [UIView commitAnimations];
                }
                
                
                // SECOND PART - MOVE
                -(void)secondAnim
                {
                    [UIView beginAnimations:@"anim2" context:NULL];
                    [UIView setAnimationBeginsFromCurrentState:YES];
                    [UIView setAnimationDuration:0.5];
                    [UIView setAnimationDidStopSelector:@selector(thirdAnim)];
                    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
                    sprite.frame = CGRectMake(170, 184, 20, 20);
                    [UIView commitAnimations];
                }
                
                // THIRD PART - SLIDE OFF SCREEN
                -(void)thirdAnim
                {   
                    [UIView beginAnimations:@"anim3" context:NULL];
                    [UIView setAnimationBeginsFromCurrentState:YES];
                    [UIView setAnimationDuration:0.5];
                    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                    sprite.frame = CGRectMake(170, 420, 20, 20);
                    [UIView commitAnimations];
                }
                

                推荐答案

                你需要添加一个调用来设置自己为动画代理:

                You need to add a call to set yourself as the animation delegate:

                [UIView setAnimationDelegate:self];
                

                最好在最后一个动画块中将自己取消设置为代理(设置为 nil).

                It would be a good idea to unset yourself as the delegate (set to nil) in the last animation block.

                这篇关于如何创建多阶段 UIImageView 动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
                When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target(在 XCode 中为多个目标编译时,我如何确保某些文件不会包含在一个目标中)
                Selecting text in mobile Safari on iPhone(在 iPhone 上的移动 Safari 中选择文本)
                How to copy text to clipboard/pasteboard with Swift(如何使用 Swift 将文本复制到剪贴板/粘贴板)
                Draggable UIImageView Partially Transparent amp; Irregular Shaped(可拖动的 UIImageView 部分透明 amp;不规则形状)
                How to set the resolution of a saved image from the UIImagePickerController(如何从 UIImagePickerController 设置保存图像的分辨率)

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

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

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

                          <tbody id='R8tMr'></tbody>

                          <bdo id='R8tMr'></bdo><ul id='R8tMr'></ul>