У меня есть ряд анимаций, которые запускаются автоматически при загрузке моего корневого контроллера представления. Эти анимации включены в viewDidLoad
. Когда я перехожу к своему следующему контроллеру представления и возвращаюсь к корневому контроллеру представления, все анимации останавливаются. То же самое происходит, когда я нажимаю кнопку «домой», а затем возвращаюсь к представлению.
Я уверен, что упустил здесь что-то очень простое, но буду признателен за любую помощь. Спасибо.
РЕДАКТИРОВАТЬ 1:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self beeBobbing];
//animate the butterfly oscillating
[self butterflyOscillate];
}
-(void) beeBobbing
{
[UIView animateWithDuration:1.0f delay:0 options:(UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionAllowUserInteraction ) animations:^{
CGPoint bottomPoint = CGPointMake(215.0, 380.0);
imgBee.center = bottomPoint;
} completion:^(BOOL finished) {
}];
}
РЕДАКТИРОВАТЬ 2: Кажется, что этот тип анимации перезапускается при переключении между представлениями:
-(void) animateClouds
{
[UIView animateWithDuration:30.0f delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
CGPoint leftScreenCenter = CGPointMake(-420.0, 119.0);
imgClouds.center = leftScreenCenter;
} completion:^(BOOL finished) {
CGPoint rightScreenCenter = CGPointMake(1450.0, 119.0);
imgClouds.center = rightScreenCenter;
[UIView animateWithDuration:40.0f delay:0 options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionRepeat) animations:^{
CGPoint leftScreenCenter = CGPointMake(-420.0, 119.0);
imgClouds.center = leftScreenCenter;
} completion:^(BOOL finished) {
}];
}];
}