search

Home  >  Q&A  >  body text

ios - 聊天界面Cell中语音消息播放动画问题

在 Cell 中有一个播放语音的图片,点击之后用uiimage通过animationImages播放几张图片,但是当 Cell 滚出屏幕之外的时候,uiimage就不动了,不知是复用覆盖了还是怎么?求大神给个解决思路啊

伊谢尔伦伊谢尔伦2827 days ago1114

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 14:30:45

    Finally I know, this is what I did,

    • (void) playVoiceAnimation;//Play voice animation
    • (void) stopVoiceAnimation;
      The above two methods are written in the cell and are used to start and stop the picture animation. The Cell has a mark. When clicking the voice, use the block to return the Cell identifier (rowIdentifier, when creating the Cell, cell.rowIdentifier = indexPath.row;) and audio File path to Chat VC

    Play the audio file after receiving it in the chat VC, and cache cell.rowIdentifier to _rowPlayVoiceAnimationIdentifier, and then traverse visibleCells. If the Cell identifier (row) is the same as the cached one, call the Cell playVoiceAnimation method
    Called after audio playback ends, same as above, call Cell stopVoiceAnimation method

    Handling when scrolling:
    //When the cell is about to be displayed, if it is a Cell that is playing the recording file, then execute the Cell to play the recording animation
    if (((ACChatTableViewCell *)cell).rowIdentifier == _rowPlayVoiceAnimationIdentifier) ​​{
    [((ACChatTableViewCell *)cell) startVoiceAnimation];
    }

    It’s a bit messy! ! !

    reply
    0
  • 迷茫

    迷茫2017-04-17 14:30:45

    Is there any demo for reference?
    632582467@qq.com

    reply
    0
  • Cancelreply