我在 WKInterfaceTable
中的 WKInterfaceImage
中有一个动画:
[[self.table setNumberOfRows:1 withRowType:@"Loading"];
WatchLoadingCell *cell = [self.table rowControllerAtIndex:0];
[cell.image setImageNamed:@"spin"];
[cell.image startAnimating];
我的图像被命名为 spin0
- spin30
并被添加到 watchKit App 目标。
当应用程序运行时,图像是静态的,即只显示 spin0
有什么想法吗?
编辑:它适用于模拟器,但不适用于设备本身,只有当我通过调用 [self awakeWithContext:nil];
从我的 Force Touch 菜单重新加载 View 时,它才适用于设备
我也试过在 willActivate
中启动动画,但没有成功
最佳答案
在代码中设置动画图片时,应该使用startAnimatingWithImagesInRange:duration:repeatCount:方法
[cell.image setImageNamed:@"spin"];
[cell.image startAnimatingWithImagesInRange:NSMakeRange(0, 30) duration:10 repeatCount:0];
如果调用 startAnimating 方法,将使用 IB 中设置的持续时间
关于ios - Apple Watch 动画在 1.0.1 后崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30501592/