I make every second a UIImageView of a french frie called FrenchFrie. I also let them move along the screen with an animation.
-(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];
}];
}
I need the position of the frie during the animation. I do this with the following code:
FrenchFrieFrame = [[FrenchFrie.layer presentationLayer] frame];
From NSLogging I know that with this code I get the position of the newest frie but I need the position of the oldest one. How can I get the position of the oldest French Frie? Any help would be really appreciated!