Hal*_*lpo 6 animation objective-c ios watchkit
我在一个WKInterfaceImage内部有一个动画WKInterfaceTable:
[[self.table setNumberOfRows:1 withRowType:@"Loading"];
WatchLoadingCell *cell = [self.table rowControllerAtIndex:0];
[cell.image setImageNamed:@"spin"];
[cell.image startAnimating];
Run Code Online (Sandbox Code Playgroud)
我的图像被命名spin0- spin30并被添加到watchKit App目标.
当应用程序运行时,图像是静态的,即仅显示 spin0
任何想法为什么?
编辑:它在模拟器中工作,但不在设备本身,它只在我通过[self awakeWithContext:nil];从我的Force Touch菜单调用重新加载视图时在设备上工作
我也尝试过willActivate没有运气的动画
小智 2
在代码中设置动画图像时,应该使用 startAnimatingWithImagesInRange:duration:repeatCount: 方法
[cell.image setImageNamed:@"spin"];
[cell.image startAnimatingWithImagesInRange:NSMakeRange(0, 30) duration:10 repeatCount:0];
Run Code Online (Sandbox Code Playgroud)
如果调用startAnimating方法,将使用IB中设置的持续时间
| 归档时间: |
|
| 查看次数: |
376 次 |
| 最近记录: |