如何以编程方式在 Swift 中将 uiimageview 设置为 xcode 内置 applewatch 图标图像?
how to programmatically, in Swift, set an uiimageview to the xcode built-in applewatch icon image?
我喜欢使用故事板添加 UIIMAGEVIEW 并将其 Image 属性设置为内置“applewatch”图标时获得的手表图标。
但是,当我以编程方式创建 UIIMAGEVIEW 时,如何将它设置为那个很酷的图标?
这里我添加了腕带的第 3 方 .png。但我想使用看起来最好的内置:
let imageName = "Wrist Band.png"
let image = UIImage(named: imageName)
let imageView = UIImageView(image: image!)
imageView.frame = CGRect(x: 0, y: 0, width: 100, height: 200)
view.addSubview(imageView)
您似乎在谈论 SF symbol applewatch
. You can get that (or any other SF symbol) by using UIImage(systemName:)
:
UIImage(systemName: "applewatch")
备注:
- 手表的颜色取决于图像视图
tintColor
- iOS14+
可用
我喜欢使用故事板添加 UIIMAGEVIEW 并将其 Image 属性设置为内置“applewatch”图标时获得的手表图标。
但是,当我以编程方式创建 UIIMAGEVIEW 时,如何将它设置为那个很酷的图标?
这里我添加了腕带的第 3 方 .png。但我想使用看起来最好的内置:
let imageName = "Wrist Band.png"
let image = UIImage(named: imageName)
let imageView = UIImageView(image: image!)
imageView.frame = CGRect(x: 0, y: 0, width: 100, height: 200)
view.addSubview(imageView)
您似乎在谈论 SF symbol applewatch
. You can get that (or any other SF symbol) by using UIImage(systemName:)
:
UIImage(systemName: "applewatch")
备注:
- 手表的颜色取决于图像视图
tintColor
- iOS14+ 可用