Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Watch animation broke after 1.0.1

I had an animation in a WKInterfaceImage within a WKInterfaceTable :

[[self.table setNumberOfRows:1 withRowType:@"Loading"];
WatchLoadingCell *cell = [self.table rowControllerAtIndex:0];

[cell.image setImageNamed:@"spin"];
[cell.image startAnimating];

My images are named spin0 - spin30 and are added to the watchKit App target.

when the app runs, the image is static, i.e only showing spin0

any ideas why?

EDIT: it works in the simulator, but not on the device itself, it works on the device only when I reload the view by calling [self awakeWithContext:nil]; from my Force Touch menu

I have also tried starting the animation in willActivate with no luck

like image 201
Halpo Avatar asked May 28 '15 08:05

Halpo


1 Answers

When setting animation images in code, you should use startAnimatingWithImagesInRange:duration:repeatCount: method

[cell.image setImageNamed:@"spin"];
[cell.image startAnimatingWithImagesInRange:NSMakeRange(0, 30) duration:10 repeatCount:0];

If you call startAnimating method, duration set in IB will be used

IB-screenshot

like image 91
skorolkov Avatar answered Sep 20 '22 11:09

skorolkov