对于 UITabarController管理的导航控制器的根界面,如果加入动画,你会发现,当应用退出到后台,然后进入到前台,你就会发现动画停止了。解决办法就是添加通知监听应用进入前台,进入活跃状态。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterPlayground) name:UIApplicationDidBecomeActiveNotification object:nil];
}
-(void)appDidEnterPlayground{
[self.heroBtn.layer removeAllAnimations];
[self.heroBtn.layer addAnimation:[self groupAnimation] forKey:nil];
}