This is my issue: I have a few animation blocks and they are all getting executed fine. But I also want to perform some animations, only if a specific BOOL value is true.
The BOOL is properly taking the TRUE value and the code enters the if statement because my log comments are getting printed. Only the animation does not seem to appear. I have tried with different CGPoint values and still the same.
Perhaps there is something I am missing out about the animations, I have not been using them a lot. Any help would be great!
Here is a code sample:
// line 4 - second particle
UIImageView* particle8 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"particle"]];
particle8.frame = CGRectMake(p8.x, p8.y, particleWidth, particleWidth);
[self addSubview:particle8];
[UIView animateWithDuration:2
delay:0
options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionRepeat
animations:^{
particle8.frame = CGRectMake(p7.x, p7.y, particleWidth, particleWidth); }
completion:^(BOOL finished){[particle8 removeFromSuperview]; }];
if (_isSmartGridOn) {
// line 2b - first particle
UIImageView* particle9 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"particle"]];
particle9.frame = CGRectMake(ep.x - 5, ep.y - 5, particleWidth, particleWidth);
[self addSubview:particle9];
[UIView animateWithDuration:1
delay:0
options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionRepeat
animations:^{
particle8.frame = CGRectMake(p10.x, p10.y, particleWidth, particleWidth); }
completion:^(BOOL finished){[particle9 removeFromSuperview]; }];
}
Aucun commentaire:
Enregistrer un commentaire