I am generating a bunch of frames which I want to animate on my Apple Watch.
According to info I've found on the internet, everyone seems to be using imageWithName
to animate a UIImage
, such as the following SO post: Is it possible to animate an UIImage?
The first answer suggest the following code which uses UIImageView
:
NSArray *animationFrames = [NSArray arrayWithObjects:
[UIImage imageWithName:@"image1.png"],
[UIImage imageWithName:@"image2.png"],
nil];
UIImageView *animatedImageView = [[UIImageView alloc] init];
animatedImageView.animationImages = animationsFrame;
[animatedImageView startAnimating];
However `UIImageView does not seem to exist in XCode 7 with Swift when I try to add it to my Apple Watch code? Why?
I also try the following code which I wrote myself:
...
var frames = [UIImage]()
var animation = UIImage()
...
//1. generate frame
//2. add to array "frames"
animation.images = frames //apply frame array to main animatable UIImage.
The last line gives me an error which says:
Cannot assign to property: 'images'is a get-only property