问题
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