gpt4 book ai didi

apple-watch - WatchOS5 - "Graphic rectangular"并发症图像大小是多少?

转载 作者:行者123 更新时间:2023-12-05 06:30:09 30 4
gpt4 key购买 nike

我正在查看 this list of complication images for WatchOS5 by Apple , 它提到 44mm watch 上的图形矩形并发症模板为 342px × 108px (171pt × 54pt @2x)

我尝试发送 342x108 图像,但它太大了 - 默认缩放模式似乎是 “center”。我也试过 171x54,但它太小而且模糊 - 我在 Apple Watch 上显示的其他图像清晰得多

图形矩形 WatchOS5 复杂功能的正确尺寸/比例是多少?应用程序或 watchkit/扩展是否可以查询可用于复杂功能的矩形?

    var image: UIImage = UIImage()

let fileManager = FileManager.default
do {
let fileURL = try //...URL of complication file

let data = try Data(contentsOf: fileURL)
image = UIImage(data: data)

} catch {
image = UIImage(named: "placeholder") ?? UIImage()
}

let textProvider = CLKSimpleTextProvider(text: SessionDelegater.title)
template.textProvider = textProvider
template.imageProvider = CLKFullColorImageProvider(fullColorImage: image)

最佳答案

部分解决方法 - 从 CGImage 手动重新创建图像并将比例因子指定为 2:

        var image: UIImage = UIImage()
do {
let fileURL = try FileManager.fileURL("complication")

let data = try Data(contentsOf: fileURL)
image = UIImage(data: data) ?? UIImage()
if let cgImage = image.cgImage {
image = UIImage(cgImage: cgImage, scale: 2, orientation: image.imageOrientation)
}

} catch {
print(error)

image = UIImage(named: "image1") ?? UIImage()
}

关于apple-watch - WatchOS5 - "Graphic rectangular"并发症图像大小是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52798201/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com