I am trying to add a SKScene with a simple animation to a UICollectionCell.
I've got my SKView setup in the .xib file of the collection view cell.
If I run it and scroll, it works as expected. But if I change to a different view controller (in a tab bar controller) that also uses those types of cells and start scrolling, it will get stuck.
Here's how I am adding the SKScene:
@interface MAPostCollectionViewCell ()
@property (strong, nonatomic) IBOutlet SKView *viewAnimation;
@property (strong, nonatomic) MAHeartAnimation *heartScene;
@end
@implementation MAPostCollectionViewCell
-(void)layoutSubviews{
[super layoutSubviews];
self.heartScene = [MAHeartAnimation sceneWithSize:self.viewAnimation.bounds.size];
self.heartScene.scaleMode = SKSceneScaleModeAspectFill;
[self.viewAnimation presentScene:self.heartScene];
}
@end
And I only trigger the animation if the user taps a button.
But for the scope of this question, the animation doesn't really matter, as I am not touching that button, just scrolling the UICollectionView.