观看OS 2 Issue设置映像 [英] Watch OS 2 Issue to set an Image

查看:75
本文介绍了观看OS 2 Issue设置映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想向WKInterfaceController添加图像,但是...

I just want to add an image to my WKInterfaceController but...

Xcode告诉我:

在Watch上找不到名为"circle44"的图片

Unable to find image named "circle44" on Watch

@IBOutlet var cirlceImage: WKInterfaceImage!
override func awakeWithContext(context: AnyObject?) {
    super.awakeWithContext(context)

    cirlceImage.setImageNamed("circle44")
}

推荐答案

好吧,我发现图像必须在您的WatchKt应用程序中而不在您的扩展程序中.加上应用程序变薄功能后,手表不再搜索1x图像,因为它们都应该是2x.

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

    }
}

这篇关于观看OS 2 Issue设置映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆