我有一个名为“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的图片。
我在苹果文档中没有找到任何关于此的参考。
func imageWithTraitCollection(traitCollection: UITraitCollection) -> UIImage
。 - ztan