【发布时间】:2015-04-22 16:49:39
【问题描述】:
我有一个名为“SmileyFace”的图像集,其中包含 1x、2x 和 3x 图像尺寸。我想从图像集中复制特定大小的粘贴板。如何在下面的代码中以编程方式引用 1x、2x 或 3x?
let image = UIImage(named: "SmileyFace" )
let image2 = UIImagePNGRepresentation( image )
UIPasteboard.generalPasteboard().setData(image2, forPasteboardType: "public.png")
此代码复制 1x。我想复制 2x 图像。
我在Apple Documentation 中没有找到任何似乎引用此内容的内容。
【问题讨论】:
-
大声笑,我本来建议你使用
func imageWithTraitCollection(traitCollection: UITraitCollection) -> UIImage
标签: ios cocoa-touch uiimage asset-catalog