Hi all. I've managed to implement a solution to this problem, however the code just seems rather inefficient and actually, the delayed method calls are proving a little troublesome when they continue to fire if the user has navigated to another screen.
Basically I want a thought bubble to appear from a character's head, but animated, so that a small bubble appears, followed by a larger one, a larger one still and eventually the main bubble which then contains a little animation. I've managed this by displaying each bubble with its own method, and then calling the methods with delays:
- (void)showMood {
animating = TRUE;
[self showBubble1];
}
- (void)showBubble1 {
bubble1.hidden = FALSE;
[self performSelector:@selector(showBubble2) withObject:nil afterDelay:kBubbleDelay];
}
- (void)showBubble2 {
bubble2.hidden = FALSE;
[self performSelector:@selector(showBubble3) withObject:nil afterDelay:kBubbleDelay];
}
- (void)showBubble3 {
bubble3.hidden = FALSE;
[self performSelector:@selector(showThoughtBubble) withObject:nil afterDelay:kBubbleDelay];
}
- (void)showThoughtBubble {
thoughtBubble.hidden = FALSE;
[self startBubbleAnimations];
[self performSelector:@selector(hideThoughtBubble) withObject:nil
afterDelay:kAnimationDuration * kAnimationRepeatCount];
}
- (void)hideThoughtBubble {
bubble1.hidden = TRUE;
bubble2.hidden = TRUE;
bubble3.hidden = TRUE;
thoughtBubble.hidden = TRUE;
[bubbleAnimation stopAnimating];
animating = FALSE;
}
I suppose I could create one large animation where the bubbles are all part of the same frame and each frame contains one more bubble, but I kind of wanted to be able to move the bubbles around a bit in Interface Builder and this approach doesn't offer much flexibility.
Any thoughts would be very much appreciated.
Thanks,
Michael