我每秒钟都制作一个名为 FrenchFrie 的法式炸薯条的 UIImageView。我还让他们通过动画沿着屏幕移动。
-(void)FrenchFrieRain{
FrenchFrie = [[UIImageView alloc] initWithFrame:CGRectMake(randomX,0,30,30)];
FrenchFrie.image = [UIImage imageNamed:@"FrenchFriesMCDonalds"];
FrenchFrie.userInteractionEnabled = YES;
[self.view addSubview:FrenchFrie];
[FrenchFrieArray addObject: FrenchFrie];
[self letFrenchFrieFall];
}
-(void)letFrenchFrieFall {
[UIView animateWithDuration:10.0f delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
FrenchFrie.frame = CGRectMake(randomX, (int)[[UIScreen mainScreen] bounds].size.height + 40, FrenchFrie.frame.size.width, FrenchFrie.frame.size.height);
} completion:^(BOOL finished){
[[FrenchFrieArray objectAtIndex:0] removeFromSuperview];
}];
}
我需要动画期间薯条的位置。我使用以下代码执行此操作:
FrenchFrieFrame = [[FrenchFrie.layer presentationLayer] frame];
从 NSLogging 我知道,通过这段代码,我得到了最新薯条的位置,但我需要最旧薯条的位置。我如何才能获得最古老的法式炸薯条的位置?任何帮助将非常感激!