Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
So, here's what happens, in a nutshell: If a condition is met, a bursting star (bunch of image views) appears on screen. If another condition is met, the same effect happens. This goes on and on until I trigger the presentation of another view controller. Upon its return, if another condition is met, the same star burst effect happens. Here's the weird part: If another condition is met, I'm supposed to see another star burst effect. What really happens is that I see stars simply flash on screen.

By the way, each condition is supposed to met in order. So the first condition is met, then the second, then the third, etc.
Here's the code I'm using for the star burst effect:

Code:
    [[self stillStarImageView] setHidden:false];
    float radius = 450;
    __block NSInteger starImageViewCount = [[self animatedStarImageViews] count];
    SEL starAnimationCompleted = @selector(starBurstAnimationCompleted);
    for (UIImageView *starImageView in [self animatedStarImageViews])
    {
        [starImageView setHidden:false];
        CGPoint stillStarCenter = [[self stillStarImageView] center];
        CGPoint starCenter = [starImageView center];
        CGPoint differencePoint = CGPointMake((starCenter.x - stillStarCenter.x), (starCenter.y - stillStarCenter.y));
        CGFloat angle = atan2f(differencePoint.y, differencePoint.x);
        CGFloat destinationX = (cosf(angle) * radius) + (stillStarCenter.x);
        CGFloat destinationY = (sinf(angle) * radius) + (stillStarCenter.y);
        CGPoint destination = CGPointMake(destinationX, destinationY);
        [UIView animateWithDuration:6 animations:^{ [starImageView setCenter:destination]; } completion:^(BOOL finished){
            [self performSelectorOnMainThread:@selector(hideImageView:) withObject:starImageView waitUntilDone:true];
            starImageViewCount = starImageViewCount - 1; NSLog(@"%ld",(long)starImageViewCount); if (starImageViewCount == 0) {
                [[self stillStarImageView] setHidden:true];
            [self performSelectorOnMainThread:starAnimationCompleted withObject:nil waitUntilDone:false]; }; }];
    }
    NSURL *burstSound = [[NSBundle mainBundle] URLForResource:@"burst" withExtension:@"mp3"];
    burstSoundItem = [AVPlayerItem playerItemWithURL:burstSound];
    [[self queuePlayer] insertItem:burstSoundItem afterItem:nil];
    [[self queuePlayer] play];

I can't think of any way to solve this problem. As you can see above, the view controller is not supposed to be prejudiced against which condition is being met.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.