问题
I just want to add an image to my WKInterfaceController but...
Xcode tells me :
Unable to find image named "circle44" on Watch
@IBOutlet var cirlceImage: WKInterfaceImage!
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
cirlceImage.setImageNamed("circle44")
}
回答1:
Okay I found the result the image have to be in your WatchKt App not on your Extension. And with the addition of app thinning the watch no longer searches for 1x images as they should all be 2x.
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBOutlet var cirlceImage: WKInterfaceImage!
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
cirlceImage.setImageNamed("circle94")
}
override func willActivate() {
super.willActivate()
}
override func didDeactivate() {
super.didDeactivate()
}
}
回答2:
Add images into imagees.xcassets select Apple Watch then add 2x into there
来源:https://stackoverflow.com/questions/32281009/watch-os-2-issue-to-set-an-image