Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watch OS 2 Issue to set an Image

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")
}
like image 221
BilalReffas Avatar asked Aug 28 '15 23:08

BilalReffas


1 Answers

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. As you see in works !

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()

    }
}
like image 185
BilalReffas Avatar answered Nov 13 '22 05:11

BilalReffas