观看 OS 2 问题以设置图像 [英] Watch OS 2 Issue to set an Image

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

问题描述

我只想将图像添加到我的 WKInterfaceController 但...

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

Xcode 告诉我:

在手表上找不到名为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 问题以设置图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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