Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要以编程方式更改 PathMenu 用于设计的图像。我有一个 PaintCode 生成的 StyleKit,它绘制 .SVG 文件,而不是 Asset.xcassets 中的图像。
PathMenu 使用这样的东西来拍摄图像:
let menuItemImage = UIImage(named: "bg-menuitem")!
但我需要做一些类似的东西
let menuItemImage = myImageFromMyStyleKit
我怎样才能使这项工作?
在 PaintCode 文档中,选择 canvas 并在 Inspector 中,从Code Export部分的下拉菜单中选择StyleKit Image Method 。
然后这个画布将生成imageOfCanvas...方法,而不是drawCanvas...方法。这样,您就可以简单地获取此画布的图像并在菜单项中使用它。
imageOfCanvas...
drawCanvas...
PathMenuItem(image: StyleKit.imageOfCanvas)