【问题标题】:Animated images for iMessage extensions?iMessage 扩展的动画图像?
【发布时间】:2017-06-26 19:56:02
【问题描述】:

我在发送图像时没有问题,但是当我尝试使用图像和 mediaFileURL 将 APNG 或 GIF 文件附加到 MSMessageTemplateLayout 时,没有任何图像是动画的...

人们如何使用 iMessage APP 发送贴纸?

NSURLComponents* components = [[NSURLComponents alloc] init];
components.queryItems = [setup iMessageData]; //returns query items array

MSMessageTemplateLayout* layout = [[MSMessageTemplateLayout alloc] init];
//loaded via assets
//layout.image = [UIImage imageNamed:@"testSticker"];

//loaded via bundle
layout.mediaFileURL = [[NSBundle mainBundle] URLForResource:@"testSticker" withExtension:@"png"];    
layout.caption = @"Test String"

MSMessage* message = [[MSMessage alloc] init];
message.URL = components.URL;
message.layout = layout;

[self.activeConversation insertMessage:message completionHandler:^(NSError * _Nullable error)

【问题讨论】:

    标签: animation imessage


    【解决方案1】:

    使用CollectionViewMSStickerBrowserViewController 创建贴纸集合。

    如果你想使用CollectionView,你需要在每个单元格内创建一个MSStickerView,所以创建一个MSStickerlet sticker = try MSSticker(contentsOfFileURL: URL_OF_FILE, localizedDescription: "PNG")

    如果您想使用MSStickerBrowserViewController,请同时创建MSSticker 并填充到stickerBrowserView(_:stickerAt:) 中(更多详细信息请参见:https://developer.apple.com/documentation/messages/msstickerbrowserviewdatasource

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-06
      • 1970-01-01
      • 2018-05-22
      • 1970-01-01
      • 2019-06-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多