【问题标题】:How to identify animations completed or not? [closed]如何识别动画是否完成? [关闭]
【发布时间】:2014-07-11 10:33:34
【问题描述】:

我正在尝试确定我的动画是否已运行并已完成,或者它仍在进行中??

animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320 , 480)];
animationImageView.animationImages = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"eg1"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg1"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg1"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"], nil];
animationImageView.animationDuration = 2.2f;
animationImageView.animationRepeatCount=1;
[self.view addSubview:animationImageView];
[animationImageView startAnimating];

谁能帮帮我?

我在一个包含UITableviewcontroller 的容器上拥有UIview,我从导航控制器向我的视图控制器提供了segue。现在我想在隐藏导航栏的情况下运行我的UIView。我尝试了代码,但是两个视图都有导航栏或两者都没有导航栏都是徒劳的。

我正在处理故事板。

实际上我将UIImageView 用于“闪屏”目的。

【问题讨论】:

  • 只是写你的问题,请尝试粘贴一些代码或你做了什么来实现它
  • 你的问题太模糊了。有很多不同种类的动画。你在做 UIView 动画吗?动画?具体是什么品种?动画完成后你需要做什么? UIView 动画和 CAAnimation 都有在动画完成时运行代码的机制。

标签: ios objective-c animation ios7 uiimage


【解决方案1】:

试试这个

[UIView animateWithDuration:2.2f animations:^{

    UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320 , 480)];
    animationImageView.animationImages = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"eg1"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg1"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg1"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"],[UIImage imageNamed:@"eg2"], nil];
    animationImageView.animationDuration = 2.2f;
    animationImageView.animationRepeatCount=1;
    [self.view addSubview:animationImageView];
    [animationImageView startAnimating];

} completion:^(BOOL finished) {
    NSLog(@"Finished");
}];

找出动画与否

    if ([YourAnimationImageView isAnimating]) {

        NSLog(@"Yes animation in progress");
    }
    else{
        NSLog(@"NO. animation has been stopped/finished");
    }

【讨论】:

    猜你喜欢
    • 2015-04-05
    • 1970-01-01
    • 2014-10-25
    • 2021-05-25
    • 2014-11-11
    • 1970-01-01
    • 1970-01-01
    • 2021-08-06
    • 2012-02-26
    相关资源
    最近更新 更多