iOS 10 Message Extension应用程序:如何获取此功能创建的MSSticker?

时间:2016-08-23 07:31:40

标签: swift ios10

我在github上找到了这个repo,可以让你从图像创建一个动画的MSSticker:

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

我打过电话后:

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

如何使贴纸出现在视图或文本栏中?我无法将其作为子视图添加到我的视图中,因此如何显示它?

1 个答案:

答案 0 :(得分:1)

查看您提供的GitHub链接,看起来Apple Documentation about MSSticker应该有所帮助。如果我没弄错,GitHub repo只是帮助你从一组UIImages中创建一个MSSticker。试试这个:

 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)