我正在尝试使用 NYTPhotoViewer 从 JSQMessagesViewController 打开一条消息。经过大量研究,我觉得我的代码正确,但继续收到错误“无法识别的选择器发送到实例”。这是代码:
override func collectionView(collectionView: JSQMessagesCollectionView, didTapMessageBubbleAtIndexPath indexPath: NSIndexPath!) {
super.collectionView(collectionView, didTapMessageBubbleAtIndexPath: indexPath)
var photos = [UIImage]()
if messages[indexPath.item].isMediaMessage {
let mediaItem: JSQMessageMediaData = messages[indexPath.item].media
let photoItem: JSQPhotoMediaItem = mediaItem as! JSQPhotoMediaItem
let image: UIImage = photoItem.image
photos.append(image)
}
let photosViewController: NYTPhotosViewController = NYTPhotosViewController(photos: photos)
presentViewController(photosViewController, animated: true, completion: nil)
}
任何帮助将不胜感激!!
谢谢