C# 在一个uiviewimage'之后触发事件以设置主动画的动画;s动画完成(单声道触摸)

C# 在一个uiviewimage'之后触发事件以设置主动画的动画;s动画完成(单声道触摸),c#,iphone,.net,ios,xamarin.ios,C#,Iphone,.net,Ios,Xamarin.ios,在一个uiviewimage的动画完成后触发事件以设置主动画的动画。 ViewDidLoad() 具有主动画逻辑。加载后,屏幕上会出现一个动画圈 屏幕上有一个按钮,它只会触发另一个动画6秒钟 我想要一个逻辑和方法,使运行上一个动画成为可能 在我看来,它可以通过回拨或线程来完成 请给出您的建议作为答案,如果您建议回拨方法,那么一段代码将是完美的 [UIView animateWithDuration:0.6f delay:0.0f

在一个uiviewimage的动画完成后触发事件以设置主动画的动画。 ViewDidLoad() 具有主动画逻辑。加载后,屏幕上会出现一个动画圈

屏幕上有一个按钮,它只会触发另一个动画6秒钟

我想要一个逻辑和方法,使运行上一个动画成为可能

在我看来,它可以通过回拨或线程来完成

请给出您的建议作为答案,如果您建议回拨方法,那么一段代码将是完美的

[UIView animateWithDuration:0.6f
                      delay:0.0f
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^{
                     // Do your animations here.
                 }
                 completion:^(BOOL finished){
                     if (finished) {
                         // Do your method here after your animation.
                     }
                 }];
如果你使用Block,你可以在动画完成后调用你想要的任何东西


如果你使用Block,你可以在动画完成后允许调用你想要的任何东西。

试试这样做

为主屏幕动画制作一个函数

       -(void)mainScreenAnimation
       {
          // do ur code here
       }
现在,当使用按钮触发动画时,将类似的内容添加到按钮事件中

   -(IBAction)btnPressed:(id)sender
   {
        // try implementing a timer which starts after 6seconds and the selector of the timer should be @selector(mainAnimationScreen)

         timer=  [NSTimer scheduledTimerWithTimeInterval:6.0 target:self selector:@selector(mainAnimationScreen) userInfo:nil repeats:NO];

     // if u want to repeat the animation then use this

       timer=  [NSTimer scheduledTimerWithTimeInterval:6.0 target:self selector:@selector(mainAnimationScreen) userInfo:nil repeats:YES];

   }

试试这样做

为主屏幕动画制作一个函数

       -(void)mainScreenAnimation
       {
          // do ur code here
       }
现在,当使用按钮触发动画时,将类似的内容添加到按钮事件中

   -(IBAction)btnPressed:(id)sender
   {
        // try implementing a timer which starts after 6seconds and the selector of the timer should be @selector(mainAnimationScreen)

         timer=  [NSTimer scheduledTimerWithTimeInterval:6.0 target:self selector:@selector(mainAnimationScreen) userInfo:nil repeats:NO];

     // if u want to repeat the animation then use this

       timer=  [NSTimer scheduledTimerWithTimeInterval:6.0 target:self selector:@selector(mainAnimationScreen) userInfo:nil repeats:YES];

   }

以下是Omar Johari的示例,转换为MonoTouch:

UIView.Animate(0.6, 0d, UIViewAnimationOptions.CurveEaseOut, 
               () => {
                      // Animations here
               }, 
               () => {
                      // After animation completes
               });

以下是Omar Johari的示例,转换为MonoTouch:

UIView.Animate(0.6, 0d, UIViewAnimationOptions.CurveEaseOut, 
               () => {
                      // Animations here
               }, 
               () => {
                      // After animation completes
               });

[...]; 这一行指向当按下按钮时被调用的块,是吗?你可以随时调用它,你有什么问题吗???@我需要mono touch的版本[…];这一行指向当按钮被触摸时被调用的块,是吗?你可以随时调用它,你有什么问题吗???@我需要mono Touch的版本,带有线程,我相信边缘有点粗糙,但很高兴你找到了解决方案。有了线程,我相信边缘有点粗糙,但很高兴你找到了解决办法。