JCHATMessageContentView.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. //
  2. // JCHATMessageContentView.m
  3. // JChat
  4. //
  5. // Created by HuminiOS on 15/11/2.
  6. // Copyright © 2015年 HXHG. All rights reserved.
  7. //
  8. #import "JCHATMessageContentView.h"
  9. #import "JChatConstants.h"
  10. #import <QMapKit/QMapKit.h>
  11. static NSInteger const textMessageContentTopOffset = 10;
  12. static NSInteger const textMessageContentRightOffset = 15;
  13. @interface JCHATMessageContentView()
  14. {
  15. QMapView *_mapView;
  16. }
  17. @property(nonatomic,strong)UIButton *loctionTapBtn;
  18. @end
  19. @implementation JCHATMessageContentView
  20. - (id)initWithFrame:(CGRect)frame {
  21. self = [super initWithFrame:frame];
  22. if (self != nil) {
  23. [self attachTapHandler];
  24. }
  25. return self;
  26. }
  27. - (id)init {
  28. self = [super init];
  29. if (self != nil) {
  30. _textContent = [UILabel new];
  31. _textContent.numberOfLines = 0;
  32. _textContent.textColor = [UIColor whiteColor];
  33. _textContent.backgroundColor = [UIColor clearColor];
  34. _infoL = [UILabel new];
  35. _infoL.numberOfLines = 0;
  36. _infoL.textColor = [UIColor whiteColor];
  37. _infoL.backgroundColor = [UIColor clearColor];
  38. _infoL.font = SYS_Font(13);
  39. _voiceConent = [UIImageView new];
  40. _isReceivedSide = NO;
  41. _mapIV = [[UIImageView alloc]init];
  42. [self addSubview:_mapIV];
  43. _imageViewAnntation = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
  44. //NSString *b_path = [[NSBundle mainBundle]pathForResource:@"QMapKit.bundle" ofType:nil];
  45. //NSString *img_path = [b_path stringByAppendingPathComponent:@"images/greenPin_lift.png"];
  46. //_imageViewAnntation.image = [UIImage imageWithContentsOfFile:img_path];
  47. _imageViewAnntation.image = [UIImage imageNamed:@"location_current"];
  48. _imageViewAnntation.backgroundColor = [UIColor clearColor];
  49. [self addSubview:_imageViewAnntation];
  50. [self addSubview:_textContent];
  51. [self addSubview:_infoL];
  52. [self addSubview:_voiceConent];
  53. _mapView = [[QMapView alloc]init];
  54. _mapView.zoomEnabled = NO;
  55. [_mapView setShowsUserLocation:NO];
  56. [_mapView setShowsScale:NO];
  57. [_mapView setScrollEnabled:NO];
  58. _loctionTapBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  59. _loctionTapBtn.backgroundColor = UIColor.clearColor;
  60. [_loctionTapBtn addTarget:self action:@selector(clickLocationTap) forControlEvents:UIControlEventTouchUpInside];
  61. [self addSubview:_loctionTapBtn];
  62. _loctionTapBtn.hidden = YES;
  63. [_loctionTapBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.width.equalTo(self.mas_width).offset(-20);
  65. make.height.equalTo(self.mas_height).offset(10);
  66. make.centerX.centerY.equalTo(self);
  67. }];
  68. }
  69. return self;
  70. }
  71. -(void)clickLocationTap {
  72. if (_message.contentType == kJMSGContentTypeLocation) {
  73. JMSGLocationContent *locationContent = (JMSGLocationContent *)_message.content;
  74. NSData *mix_data = [locationContent.address dataUsingEncoding:NSUTF8StringEncoding];
  75. NSDictionary *mix_dic = [NSJSONSerialization JSONObjectWithData:mix_data options:NSJSONReadingAllowFragments error:nil];
  76. NSString *endName = YZMsg(@"终点位置");
  77. if ([mix_dic isKindOfClass:[NSDictionary class]]) {
  78. endName = [NSString stringWithFormat:@"%@",[mix_dic valueForKey:@"name"]];
  79. }
  80. NSLog(@"点击了定位=lng:%@==lat:%@",locationContent.longitude,locationContent.latitude);
  81. [[RKLBSManager shareManager]showNavigationsWithLat:locationContent.latitude lng:locationContent.longitude endName:endName];
  82. }else{
  83. NSLog(@"点击了非定位");
  84. }
  85. }
  86. - (void)setMessageContentWith:(JMSGMessage *)message{
  87. [self setMessageContentWith:message handler:nil];
  88. }
  89. - (void)setMessageContentWith:(JMSGMessage *)message handler:(void (^)(NSUInteger))block {
  90. BOOL isReceived = [message isReceived];
  91. _message = message;
  92. UIImageView *maskView = nil;
  93. UIImage *maskImage = nil;
  94. if (isReceived) {
  95. maskImage = [UIImage imageNamed:@"chat_bg_other"];
  96. //发送地理位置要求背景色为白色
  97. if (message.contentType == kJMSGContentTypeLocation) {
  98. maskImage = [UIImage imageNamed:@"chat_bg_location_other"];
  99. }
  100. } else {
  101. maskImage = [UIImage imageNamed:@"chat_bg_my"];
  102. if (message.contentType == kJMSGContentTypeLocation) {
  103. maskImage = [UIImage imageNamed:@"chat_bg_location_my"];
  104. }
  105. }
  106. //maskImage = [maskImage resizableImageWithCapInsets:UIEdgeInsetsMake(28, 20, 28, 20)];
  107. maskImage = [maskImage resizableImageWithCapInsets:UIEdgeInsetsMake(30, 20, 30, 20)];
  108. // [self setImage:maskImage];
  109. /*
  110. maskView = [UIImageView new];
  111. maskView.image = maskImage;
  112. [maskView setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
  113. self.layer.mask = maskView.layer;
  114. */
  115. self.contentMode = UIViewContentModeScaleToFill;
  116. _textContent.textAlignment = NSTextAlignmentLeft;
  117. _textContent.textColor = [UIColor whiteColor];
  118. self.backgroundColor = [UIColor clearColor];
  119. _loctionTapBtn.hidden = YES;
  120. switch (message.contentType) {
  121. case kJMSGContentTypeText:{
  122. [self setImage:maskImage];
  123. _voiceConent.hidden = YES;
  124. _textContent.hidden = NO;
  125. _infoL.hidden = YES;
  126. _mapIV.hidden = YES;
  127. _imageViewAnntation.hidden = YES;
  128. if (isReceived) {
  129. [_textContent setFrame:CGRectMake(textMessageContentRightOffset + 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, self.frame.size.height- 2 * textMessageContentTopOffset)];
  130. } else {
  131. [_textContent setFrame:CGRectMake(textMessageContentRightOffset - 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, self.frame.size.height- 2 * textMessageContentTopOffset)];
  132. }
  133. _textContent.text = ((JMSGTextContent *)message.content).text;
  134. //匹配表情文字
  135. NSString *pattern = emojiPattern;
  136. NSArray *resultArr = [self machesWithPattern:pattern andStr:_textContent.text];
  137. if (!resultArr) return;
  138. NSUInteger lengthDetail = 0;
  139. NSMutableAttributedString *attstr = [[NSMutableAttributedString alloc]initWithString:_textContent.text];
  140. //遍历所有的result 取出range
  141. for (NSTextCheckingResult *result in resultArr) {
  142. //取出图片名
  143. NSString *imageName = [_textContent.text substringWithRange:NSMakeRange(result.range.location, result.range.length)];
  144. if ([lagType isEqual:EN]) {
  145. if ([imageName isEqual:@"[互粉]"] ||
  146. [imageName isEqual:@"[关注]"] ||
  147. [imageName isEqual:@"[粉]"] ||
  148. [imageName isEqual:@"[给力]"]) {
  149. imageName = [imageName stringByAppendingFormat:@"_en"];
  150. }
  151. }
  152. NSLog(@"--------%@",imageName);
  153. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  154. UIImage *emojiImage = [UIImage imageNamed:imageName];
  155. NSAttributedString *imageString;
  156. if (emojiImage) {
  157. /*
  158. attach.image = emojiImage;
  159. attach.bounds = CGRectMake(0, -5, 21, 21);
  160. imageString = [NSAttributedString attributedStringWithAttachment:attach];
  161. */
  162. UIImageView *imageV = [[UIImageView alloc] init];
  163. imageV.frame = CGRectMake(0, -2, 15, 15);
  164. imageV.image = emojiImage;
  165. imageString = [NSAttributedString yy_attachmentStringWithContent:imageV contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(15, 15) alignToFont:_textContent.font alignment:YYTextVerticalAlignmentCenter];
  166. }else{
  167. imageString = [[NSMutableAttributedString alloc]initWithString:imageName];
  168. }
  169. //图片附件的文本长度是1
  170. NSLog(@"emoj===%zd===size-w:%f==size-h:%f",imageString.length,imageString.size.width,imageString.size.height);
  171. NSUInteger length = attstr.length;
  172. NSRange newRange = NSMakeRange(result.range.location - lengthDetail, result.range.length);
  173. [attstr replaceCharactersInRange:newRange withAttributedString:imageString];
  174. lengthDetail += length - attstr.length;
  175. }
  176. //更新到label上
  177. _textContent.attributedText = attstr;
  178. }break;
  179. case kJMSGContentTypeImage: {
  180. _voiceConent.hidden = YES;
  181. _textContent.hidden = YES;
  182. _infoL.hidden = YES;
  183. _mapIV.hidden = YES;
  184. _imageViewAnntation.hidden = YES;
  185. self.contentMode = UIViewContentModeScaleAspectFill;
  186. [(JMSGImageContent *)message.content thumbImageData:^(NSData *data, NSString *objectId, NSError *error) {
  187. if (error == nil) {
  188. if (data != nil) {
  189. [self setImage:[UIImage imageWithData:data]];
  190. } else {
  191. [self setImage:[UIImage imageNamed:@"receiveFail"]];
  192. }
  193. } else {
  194. [self setImage:[UIImage imageNamed:@"receiveFail"]];
  195. }
  196. if (block) {
  197. NSData *imageData = UIImagePNGRepresentation(self.image);
  198. block(imageData.length);
  199. }
  200. }];
  201. }break;
  202. case kJMSGContentTypeVoice: {
  203. [self setImage:maskImage];
  204. _textContent.hidden = YES;
  205. _infoL.hidden = YES;
  206. _voiceConent.hidden = NO;
  207. _mapIV.hidden = YES;
  208. _imageViewAnntation.hidden = YES;
  209. if (isReceived) {//height = 50
  210. [_voiceConent setFrame:CGRectMake(20, 15, 20, 20)];
  211. [_voiceConent setImage:[UIImage imageNamed:@"ReceiverVoiceNodePlaying"]];
  212. } else {
  213. [_voiceConent setFrame:CGRectMake(self.frame.size.width - 40, 15, 20, 20)];
  214. [_voiceConent setImage:[UIImage imageNamed:@"SenderVoiceNodePlaying"]];
  215. }
  216. [((JMSGVoiceContent *)message.content) voiceData:^(NSData *data, NSString *objectId, NSError *error) {
  217. if (error == nil) {
  218. if (block) {
  219. block(data.length);
  220. }
  221. } else {
  222. DDLogDebug(@"get message voiceData fail with error %@",error);
  223. }
  224. }];
  225. }break;
  226. case kJMSGContentTypeFile: {
  227. _voiceConent.hidden = YES;
  228. _textContent.hidden = NO;
  229. _infoL.hidden = YES;
  230. _mapIV.hidden = YES;
  231. _imageViewAnntation.hidden = YES;
  232. self.contentMode = UIViewContentModeScaleAspectFit;
  233. [self setImage:[UIImage imageNamed:@"file_message_bg"]];
  234. JMSGFileContent *fileContent = (JMSGFileContent *)message.content;
  235. _textContent.text = fileContent.fileName;
  236. _textContent.textAlignment = NSTextAlignmentRight;
  237. if (isReceived) {
  238. [_textContent setFrame:CGRectMake(textMessageContentRightOffset + 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, self.frame.size.height- 2 * textMessageContentTopOffset)];
  239. } else {
  240. [_textContent setFrame:CGRectMake(textMessageContentRightOffset - 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, self.frame.size.height- 2 * textMessageContentTopOffset)];
  241. }
  242. }break;
  243. case kJMSGContentTypeLocation: {
  244. _loctionTapBtn.hidden = NO;
  245. [self setImage:maskImage];
  246. _voiceConent.hidden = YES;
  247. _textContent.hidden = NO;
  248. _infoL.hidden = NO;
  249. _mapIV.hidden = NO;
  250. _imageViewAnntation.hidden = NO;
  251. self.contentMode = UIViewContentModeScaleAspectFit;
  252. //[self setImage:[UIImage imageNamed:@"location_address"]];
  253. JMSGLocationContent *locationContent = (JMSGLocationContent *)message.content;
  254. NSData *mix_data = [locationContent.address dataUsingEncoding:NSUTF8StringEncoding];
  255. NSDictionary *mix_dic = [NSJSONSerialization JSONObjectWithData:mix_data options:NSJSONReadingAllowFragments error:nil];
  256. if ([mix_dic isKindOfClass:[NSDictionary class]]) {
  257. _textContent.text = [NSString stringWithFormat:@"%@",[mix_dic valueForKey:@"name"]];
  258. _infoL.text = [NSString stringWithFormat:@"%@",[mix_dic valueForKey:@"info"]];
  259. }else {
  260. _textContent.text = locationContent.address;
  261. }
  262. _textContent.textColor = RGB_COLOR(@"#323232", 1);
  263. _infoL.textColor = RGB_COLOR(@"#646464", 1);
  264. if (isReceived) {
  265. self.backgroundColor = RGB_COLOR(@"#ffffff", 1);
  266. [_textContent setFrame:CGRectMake(textMessageContentRightOffset + 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, 20)];
  267. [_infoL setFrame:CGRectMake(textMessageContentRightOffset + 5, _textContent.bottom, self.frame.size.width - 2 * textMessageContentRightOffset, 15)];
  268. } else {
  269. self.backgroundColor = RGB_COLOR(@"#ffffff", 1);
  270. [_textContent setFrame:CGRectMake(textMessageContentRightOffset - 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, 20)];
  271. [_infoL setFrame:CGRectMake(textMessageContentRightOffset - 5, _textContent.bottom, self.frame.size.width - 2 * textMessageContentRightOffset, 15)];
  272. }
  273. [_mapIV setFrame:CGRectMake(0, _infoL.bottom, self.width, self.height-textMessageContentTopOffset-35)];
  274. /*
  275. [_mapView setFrame:CGRectMake(0, _infoL.bottom, self.width, self.height-textMessageContentTopOffset-35)];
  276. CLLocationCoordinate2D center;
  277. center.latitude = [locationContent.latitude doubleValue];
  278. center.longitude = [locationContent.longitude doubleValue];
  279. [_mapView setCenterCoordinate:center zoomLevel:16.01 animated:NO];
  280. [_mapView takeSnapshotInRect:_mapView.bounds withCompletionBlock:^(UIImage *resultImage, CGRect rect) {
  281. [_mapIV setImage:resultImage];
  282. }];
  283. */
  284. NSString *url = @"https://apis.map.qq.com/ws/staticmap/v2/";
  285. NSDictionary *postDic = @{@"key":TencentKey,
  286. @"scale":@"1",
  287. @"size":[NSString stringWithFormat:@"%.f*%.f",_mapIV.width,_mapIV.height],
  288. @"center":[NSString stringWithFormat:@"%@,%@",locationContent.latitude,locationContent.longitude],
  289. @"zoom":@"16"};
  290. url = [url stringByAppendingFormat:@"?%@",[YBNetworking getStrWithDic:postDic]];
  291. [_mapIV sd_setImageWithURL:[NSURL URLWithString:url]];
  292. _imageViewAnntation.center = _mapIV.center;
  293. }break;
  294. case kJMSGContentTypeUnknown:
  295. [self setImage:maskImage];
  296. _voiceConent.hidden = YES;
  297. _textContent.hidden = NO;
  298. _mapIV.hidden = YES;
  299. _imageViewAnntation.hidden = YES;
  300. if (isReceived) {
  301. [_textContent setFrame:CGRectMake(textMessageContentRightOffset + 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, self.frame.size.height- 2 * textMessageContentTopOffset)];
  302. } else {
  303. [_textContent setFrame:CGRectMake(textMessageContentRightOffset - 5, textMessageContentTopOffset, self.frame.size.width - 2 * textMessageContentRightOffset, self.frame.size.height- 2 * textMessageContentTopOffset)];
  304. }
  305. _textContent.text = st_receiveUnknowMessageDes;
  306. break;
  307. case kJMSGContentTypeCustom:
  308. // [self setImage:maskImage];
  309. // _voiceConent.hidden = YES;
  310. // _textContent.hidden = NO;
  311. // _infoL.hidden = YES;
  312. // _mapIV.hidden = YES;
  313. // _imageViewAnntation.hidden = YES;
  314. // [_textContent setFrame:CGRectMake(0, textMessageContentTopOffset, self.frame.size.width , self.frame.size.height- 2 * textMessageContentTopOffset)];
  315. // _textContent.text = @"12123123123213123";
  316. break;
  317. default:
  318. break;
  319. }
  320. }
  321. - (NSArray <NSTextCheckingResult *> *)machesWithPattern:(NSString *)pattern andStr:(NSString *)str
  322. {
  323. NSError *error = nil;
  324. NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:&error];
  325. if (error)
  326. {
  327. NSLog(@"正则表达式创建失败");
  328. return nil;
  329. }
  330. return [expression matchesInString:str options:0 range:NSMakeRange(0, str.length)];
  331. }
  332. - (BOOL)canBecomeFirstResponder{
  333. return YES;
  334. }
  335. -(void)attachTapHandler{
  336. self.userInteractionEnabled = YES; //用户交互的总开关
  337. UILongPressGestureRecognizer *touch = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
  338. touch.minimumPressDuration = 0.5;
  339. [self addGestureRecognizer:touch];
  340. }
  341. //rk20201030
  342. - (void)menuViewDidHide:(NSNotification*)notification {
  343. //重置,不影响原有的响应链
  344. self.passRKTextView.overrideNextResponder = nil;
  345. [[NSNotificationCenter defaultCenter] removeObserver:self name:UIMenuControllerDidHideMenuNotification object:nil];
  346. }
  347. #pragma mark - 消息撤回
  348. -(void)handleTap:(UIGestureRecognizer*) recognizer {
  349. if (recognizer.state != UIGestureRecognizerStateBegan) {
  350. return;
  351. }
  352. // [self becomeFirstResponder];
  353. //rk20201030 - UIMenuController和键盘并存
  354. if(self.passRKTextView.isFirstResponder){
  355. self.passRKTextView.overrideNextResponder = self;
  356. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(menuViewDidHide:) name:UIMenuControllerDidHideMenuNotification object:nil];
  357. }else {
  358. [self becomeFirstResponder];
  359. }
  360. BOOL isReceived = [_message isReceived];
  361. UIMenuController *menuC = [UIMenuController sharedMenuController];
  362. UIMenuItem *copyItem = [[UIMenuItem alloc]initWithTitle:YZMsg(@"复制") action:@selector(clickCopyItem)];
  363. UIMenuItem *retractItem = [[UIMenuItem alloc]initWithTitle:YZMsg(@"撤回") action:@selector(clickRetractItem)];
  364. NSMutableArray *addItems = [NSMutableArray array];
  365. if (_message.contentType == kJMSGContentTypeText) {
  366. [addItems addObject:copyItem];
  367. }
  368. if (!isReceived) {
  369. //自己的消息
  370. [addItems addObject:retractItem];
  371. }
  372. if (addItems.count>0) {
  373. [menuC setMenuItems:[NSArray arrayWithArray:addItems]];
  374. [menuC setTargetRect:self.frame inView:self.superview];
  375. [menuC setMenuVisible:YES animated:YES];
  376. }
  377. }
  378. -(void)clickCopyItem {
  379. __block UIPasteboard *pboard = [UIPasteboard generalPasteboard];
  380. switch (_message.contentType) {
  381. case kJMSGContentTypeText:{
  382. JMSGTextContent *textContent = (JMSGTextContent *)_message.content;
  383. pboard.string = textContent.text;
  384. [MBProgressHUD showPop:YZMsg(@"复制成功")];
  385. }break;
  386. default:
  387. break;
  388. }
  389. }
  390. -(void)clickRetractItem {
  391. NSTimeInterval time = [[NSDate date] timeIntervalSince1970];
  392. long long int currentTime = (long long int)time;
  393. long long msgTime = [_message.timestamp longLongValue]/1000;
  394. //NSLog(@"====:%@======u:%lld=====n:%lld",_message.timestamp,currentTime,msgTime);
  395. if (currentTime > (msgTime+2*60)) {
  396. [MBProgressHUD showPop:YZMsg(@"该消息发送时间已超过两分钟,无法撤回")];
  397. }else {
  398. [[NSNotificationCenter defaultCenter] postNotificationName:kRetractMsg object:_message];
  399. }
  400. }
  401. /*
  402. -(void)handleTap:(UIGestureRecognizer*) recognizer {
  403. [self becomeFirstResponder];
  404. [[UIMenuController sharedMenuController] setTargetRect:self.frame inView:self.superview];
  405. [[UIMenuController sharedMenuController] setMenuVisible:YES animated: YES];
  406. }
  407. #pragma mark - 长按选项
  408. -(BOOL)canPerformAction:(SEL)action withSender:(id)sender {
  409. if (_message.contentType == kJMSGContentTypeVoice) {
  410. return action == @selector(delete:);
  411. }
  412. return (action == @selector(copy:) || action == @selector(delete:));
  413. return NO;
  414. }
  415. -(void)copy:(id)sender {
  416. __block UIPasteboard *pboard = [UIPasteboard generalPasteboard];
  417. switch (_message.contentType) {
  418. case kJMSGContentTypeText:
  419. {
  420. JMSGTextContent *textContent = (JMSGTextContent *)_message.content;
  421. pboard.string = textContent.text;
  422. }
  423. break;
  424. case kJMSGContentTypeImage:
  425. {
  426. JMSGImageContent *imgContent = (JMSGImageContent *)_message.content;
  427. [imgContent thumbImageData:^(NSData *data, NSString *objectId, NSError *error) {
  428. if (data == nil || error) {
  429. UIWindow *myWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  430. //[MBProgressHUD showMessage:@"获取图片错误" view:myWindow];
  431. [MBProgressHUD showMessage:YZMsg(@"获取图片错误") toView:myWindow];
  432. return ;
  433. }
  434. pboard.image = [UIImage imageWithData:data];
  435. }];
  436. }
  437. break;
  438. case kJMSGContentTypeVoice:
  439. break;
  440. case kJMSGContentTypeUnknown:
  441. break;
  442. default:
  443. break;
  444. }
  445. }
  446. -(void)delete:(id)sender {
  447. [[NSNotificationCenter defaultCenter] postNotificationName:kDeleteMessage object:_message];
  448. }
  449. */
  450. @end