Copy Image with UIPasteBoard (Swift)

后端 未结 2 856
星月不相逢
星月不相逢 2021-02-04 19:15

I recently saw this project in which a user can tap on a GIF from a custom keyboard and they would see a \"copied\" toolip appear. I have one question:

  • How does on
2条回答
  •  天涯浪人
    2021-02-04 19:38

    Try using this code:

    let image = UIImage(named: "myimage.png")
    UIPasteboard.generalPasteboard().image = image;
    

    you can find out how this works here!

    Hope this helps

    Swift 5.1

    UIPasteboard.general.image = image
    

提交回复
热议问题