我知道一吨的人都问了同样的问题,但没有提出的解决方案似乎相关,所以我再次问: 我有下面的代码块:animateWithDuration立即完成
UIImageView *moneyHolder = [[UIImageView alloc] initWithImage:moneyImage];
if([paymentMethod.viewed intValue] == 0){
//CGRect targetFrame = CGRectMake(0, cell.frame.size.height/2-3, cell.frame.size.width, targetHeight);
CGRect targetFrame = moneyHolder.frame;
targetFrame.origin.y = cell.frame.size.height/2-3;
NSLog(@"animating");
[UIView animateWithDuration:2
delay:0
options: UIViewAnimationCurveEaseOut
animations:^{
moneyHolder.frame = targetFrame;
}
completion:^(BOOL finished){
NSLog(@"done");
}
];
}
我会认为应该动画我的钱箱框架。不幸的是,这似乎是立即发生的,而不是持续2秒。
2012-05-11 03:41:50.102 AgilePoet [5824:15203]动画
2012-05-11 03:41:50.116 AgilePoet [5824:15203]已完成,我可以从我的日志时间戳验证这一点
有没有人有任何想法,为什么这可能会发生?关于此主题的所有其他问题都集中在该属性不具动画性,但我知道一个imageview框架具有动画能力。我唯一能想到的就是这段代码写在我的内部
-tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath method.
在此先感谢!
很高兴看到你有什么可能导致问题的理论。你可以通过将动画代码临时复制到别的地方来测试它,看看它是否像你期望的那样行事? –
以及我移动了willDisplayCell方法之外的代码,它的工作......有谁知道为什么它不会在willDisplayCell内工作? – akhalsa
我的猜测是willDisplayCell的绘图代码会调用单元图层上的removeAllAnimations,从而过早地结束您的动画。 –