所以我试图让我的 watchOS 2 复杂功能显示图像。研究让我找到了这些链接:
https://www.bignerdranch.com/blog/watchkit-2-complications/ http://techotopia.com/index.php/A_watchOS_2_Complication_Tutorial https://developer.apple.com/library/prerelease/watchos/documentation/ClockKit /Reference/CLKImageProvider_class/index.html#//apple_ref/occ/cl/CLKImageProvider https://forums.developer.apple.com/thread/7426
我已经尝试使用图像资产来解决复杂问题,以及仅将单个图像导入项目中。我加载图像的代码如下:
lazy var utilitarianImageProvider: CLKImageProvider? = {
if let image = UIImage(named: "Complication/Utilitarian") {
return CLKImageProvider(onePieceImage: image)
}
else {
print("Cannot find image named 'Complication/Utilitarian'")
}
return nil
}()
但这只会导致这个图像:
我要加载的图像是:
我尝试了彩色图像和单色图像,但总是得到相同的结果。