iOS 10 Message Extension app: How can I get the MSSticker created by this function?

我是研究僧i 提交于 2019-12-12 03:37:22

问题


I found this repo on github that enables you to create an animated MSSticker from images:

https://github.com/radif/MSSticker-Images

Once I have called:

let sticker = MSSticker(images: images, frameDelay: 1.0/14.0, numberOfLoops: 0, localizedDescription: "generated sticker")

How do I make the sticker appear in the view or the text bar? I can't add it as a subview to my view, so how do I show it?


回答1:


Looking at the GitHub link you provided it seems like a look at the Apple Documentation about MSSticker should help. And if I am not mistaken that GitHub repo is just helping you create an MSSticker from an array of UIImages. Try this out:

 let yourSticker = MSSticker(images: images, frameDelay: 1.0/14.0, numberOfLoops: 0, localizedDescription: "generated sticker")
 // stickerView is an MSStickerView, which inherits from UIView
 let stickerView = init(CGRect(...), sticker: yourSticker)
 yourView.addSubview(stickerView)


来源:https://stackoverflow.com/questions/39094981/ios-10-message-extension-app-how-can-i-get-the-mssticker-created-by-this-functi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!