JXMessageCell.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. //
  2. // JXMessageCell.m
  3. // shiku_im
  4. //
  5. // Created by Apple on 16/10/10.
  6. // Copyright © 2016年 Reese. All rights reserved.
  7. //
  8. #import "JXMessageCell.h"
  9. #import "emojiViewController.h"
  10. #import "EmojiTextAttachment.h"
  11. //#define TEXT_MAX_HEIGHT 500.0f
  12. @implementation JXMessageCell
  13. - (void)awakeFromNib {
  14. [super awakeFromNib];
  15. // self.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, 55);
  16. }
  17. - (void)dealloc {
  18. [self.readDelTimer invalidate];
  19. self.readDelTimer = nil;
  20. }
  21. -(void)creatUI{
  22. _messageConent=[[JXEmoji alloc] init];
  23. _messageConent.userInteractionEnabled = YES;
  24. _messageConent.lineBreakMode = NSLineBreakByWordWrapping;
  25. _messageConent.numberOfLines = 0;
  26. _messageConent.backgroundColor = [UIColor clearColor];
  27. [self.bubbleBg addSubview:_messageConent];
  28. _timeIndexLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
  29. _timeIndexLabel.layer.cornerRadius = _timeIndexLabel.frame.size.width / 2;
  30. _timeIndexLabel.layer.masksToBounds = YES;
  31. _timeIndexLabel.textColor = [UIColor whiteColor];
  32. _timeIndexLabel.backgroundColor = HEXCOLOR(0x02d8c9);
  33. _timeIndexLabel.textAlignment = NSTextAlignmentCenter;
  34. _timeIndexLabel.text = @"0";
  35. _timeIndexLabel.font = [UIFont systemFontOfSize:12.0];
  36. _timeIndexLabel.hidden = YES;
  37. [self.contentView addSubview:_timeIndexLabel];
  38. UITapGestureRecognizer * tapPress = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dotapPress:)];
  39. [self.contentView addGestureRecognizer:tapPress];
  40. }
  41. - (void)dotapPress:(UITapGestureRecognizer *)tap {
  42. if (self.block) {
  43. self.block(self.msg);
  44. }
  45. }
  46. -(void)setCellData{
  47. [super setCellData];
  48. JLBubbleManager *bubbleManager;
  49. if (self.msg.isGroup) {
  50. memberData *data = [[memberData alloc] init];
  51. data.roomId = self.room.roomId;
  52. data = [data getCardNameById:self.msg.fromUserId];
  53. if (data.bubbleFontId.length <= 0) {
  54. bubbleManager = [JLBubbleManager sharedManager];
  55. bubbleManager.id = @"0";
  56. }else {
  57. bubbleManager = [[JLBubbleManager sharedManager] fechGradeByBubbleFontId:data.bubbleFontId];
  58. }
  59. // NSLog(@"ID--%@---fromUserId%@--%@", data.bubbleFontId,self.msg.fromUserId,bubbleManager);
  60. }else {
  61. // 单聊
  62. // 从朋友表里获取
  63. JXUserObject *user;
  64. if (self.msg.isMySend) {
  65. user = [[JXUserObject sharedInstance] getUserById:MY_USER_ID];
  66. }else {
  67. user = [[JXUserObject sharedInstance] getUserById:self.msg.fromUserId];
  68. }
  69. bubbleManager = [[JLBubbleManager sharedManager] fechGradeByBubbleFontId:user.bubbleFontId];
  70. }
  71. if (bubbleManager == nil) {
  72. _messageConent.font = [[JLBubbleManager sharedManager] getBubbleFontNameIndex:-1];
  73. _messageConent.textColor = [[JLBubbleManager sharedManager] getBubbleFontColor:@""];
  74. }else {
  75. _messageConent.font = [[JLBubbleManager sharedManager] getBubbleFontNameIndex:[bubbleManager.code intValue]];
  76. _messageConent.textColor = [[JLBubbleManager sharedManager] getBubbleFontColor:bubbleManager.color];
  77. }
  78. _messageConent.textColor =[UIColor blackColor];
  79. // 设置显示字体
  80. _messageConent.frame = CGRectMake(0, 0, 200, 20);
  81. if (self.msg.objectId.length > 0) {
  82. _messageConent.atUserIdS = self.msg.objectId;
  83. }
  84. if ([self.msg.isReadDel boolValue] && ([self.msg.fileName length] <= 0 || [self.msg.fileName intValue] <= 0) && !self.msg.isMySend) {
  85. _messageConent.userInteractionEnabled = NO;
  86. _messageConent.text = [NSString stringWithFormat:@"%@ T", Localized(@"JX_ClickAndView")];
  87. // _messageConent.textColor = HEXCOLOR(0x0079FF);
  88. _timeIndexLabel.hidden = YES;
  89. }else {
  90. _messageConent.userInteractionEnabled = YES;
  91. // _messageConent.textColor = HEXCOLOR(0x333333);
  92. // _messageConent.textColor = [UIColor whiteColor];
  93. if ([self.msg.content containsString:@"===jixin"]) {
  94. NSArray *typeArr = [self.msg.content componentsSeparatedByString:@"===jixin"];
  95. _messageConent.text=[typeArr firstObject];
  96. }else{
  97. _messageConent.text = self.msg.content;
  98. }
  99. NSLog(@"000000%@",self.msg.content);
  100. _timeIndexLabel.hidden = YES;
  101. if (!self.msg.isMySend && [self.msg.fileName isKindOfClass:[NSString class]] && [self.msg.fileName length] > 0 && [self.msg.fileName intValue] > 0) {
  102. self.timeIndexLabel.hidden = NO;
  103. NSString *messageR = [self.msg.content stringByReplacingOccurrencesOfString:@"\r" withString:@""]; //去掉回车键
  104. NSString *messageN = [messageR stringByReplacingOccurrencesOfString:@"\n" withString:@""]; //去掉回车键
  105. NSString *messageText = [messageN stringByReplacingOccurrencesOfString:@" " withString:@""]; //去掉空格
  106. NSMutableAttributedString * textC = [self changeEmjoyText:messageText];
  107. [textC addAttribute:NSFontAttributeName value:SYSFONT(g_constant.chatFont) range:NSMakeRange(0, textC.length)];
  108. CGSize size = [textC boundingRectWithSize:CGSizeMake(_messageConent.frame.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size;
  109. NSInteger count = size.height / _messageConent.font.lineHeight;
  110. NSLog(@"countcount === %ld-----%f-----%@",count,[[NSDate date] timeIntervalSince1970],self.msg.fileName);
  111. // NSLog(@"countcount === %ld,,,,%f,,,,%@",count,[[NSDate date] timeIntervalSince1970], self.msg.fileName);
  112. count = count * 10 - ([[NSDate date] timeIntervalSince1970] - [self.msg.fileName longLongValue]);
  113. self.timerIndex = count;
  114. NSLog(@"countcount1 === %ld",count);
  115. if (count > 0) {
  116. self.timeIndexLabel.text = [NSString stringWithFormat:@"%ld",count];
  117. if (!self.readDelTimer) {
  118. self.readDelTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerAction:) userInfo:nil repeats:YES];
  119. }
  120. }else {
  121. self.msg.fileName = @"0";
  122. //阅后即焚通知
  123. [g_notify postNotificationName:kCellReadDelNotification object:self.msg];
  124. [self deleteMsg:self.msg];
  125. }
  126. }
  127. }
  128. [self creatBubbleBg];
  129. }
  130. -(void)creatBubbleBg{
  131. CGSize textSize = _messageConent.frame.size;
  132. int n = textSize.width;
  133. //聊天长度反正就是算错了,强行改
  134. if(n){
  135. // n -= 10;
  136. }
  137. int inset = 3;
  138. if(self.msg.isMySend){
  139. self.bubbleBg.frame=CGRectMake(CGRectGetMinX(self.headImage.frame)-INSETS*2-inset*2-n-CHAT_WIDTH_ICON, INSETS, n+INSETS*2+inset*2, textSize.height+INSETS*2);
  140. self.bubbleBgImageView.frame = CGRectMake(0, 0, n+INSETS*2+inset*2, textSize.height+INSETS*2+INSETS);
  141. [_messageConent setFrame:CGRectMake(INSETS*0.4 + 3 +5, 10, n + 5, textSize.height)];
  142. // [_messageConent setFrame:CGRectMake(INSETS*0.4 + 3, INSETS, n + 5, textSize.height+50)];
  143. _timeIndexLabel.frame = CGRectMake(self.bubbleBg.frame.origin.x - 30, self.bubbleBg.frame.origin.y, 20, 20);
  144. }else
  145. {
  146. self.bubbleBg.frame=CGRectMake(CGRectGetMaxX(self.headImage.frame) + CHAT_WIDTH_ICON, INSETS2(self.msg.isGroup)+9, n+INSETS*2+inset*2, textSize.height+INSETS*2);
  147. self.bubbleBgImageView.frame =CGRectMake(0, 2, n+INSETS*2+inset*2, textSize.height+INSETS*2+20);
  148. [_messageConent setFrame:CGRectMake(INSETS + 3, 10, n+5, textSize.height)];
  149. _timeIndexLabel.frame = CGRectMake(CGRectGetMaxX(self.bubbleBg.frame) + 10, self.bubbleBg.frame.origin.y, 20, 20);
  150. // _messageConent.textAlignment = NSTextAlignmentLeft;
  151. }
  152. if (self.msg.isShowTime) {
  153. CGRect frame = self.bubbleBg.frame;
  154. frame.origin.y = self.bubbleBg.frame.origin.y + 40;
  155. self.bubbleBg.frame = frame;
  156. _timeIndexLabel.frame = CGRectMake(_timeIndexLabel.frame.origin.x, self.bubbleBg.frame.origin.y, 20, 20);
  157. }
  158. }
  159. - (void)setBackgroundImage {
  160. [super setBackgroundImage];
  161. if (!self.msg.isMySend && [self.msg.fileName isKindOfClass:[NSString class]] && [self.msg.fileName length] > 0 && [self.msg.fileName intValue] >= 0 && [self.msg.type intValue] == kWCMessageTypeText) {
  162. self.isDidMsgCell = YES;
  163. }
  164. if ([self.msg.isReadDel boolValue] && !self.msg.isMySend && self.isDidMsgCell) {
  165. [self drawReadDelView:YES];
  166. self.isDidMsgCell = NO;
  167. }
  168. }
  169. //复制信息到剪贴板
  170. - (void)myCopy{
  171. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  172. [pasteboard setString:self.msg.content];
  173. }
  174. + (float)getChatCellHeight:(JXMessageObject *)msg {
  175. if ([msg.chatMsgHeight floatValue] > 1) {
  176. return [msg.chatMsgHeight floatValue];
  177. }
  178. float n = 0.0;
  179. JXEmoji *messageConent=[[JXEmoji alloc]initWithFrame:CGRectMake(0, 0, 200, 20)];
  180. messageConent.backgroundColor = [UIColor clearColor];
  181. // messageConent.userInteractionEnabled = NO;
  182. messageConent.numberOfLines = 0;
  183. messageConent.lineBreakMode = NSLineBreakByWordWrapping;//UILineBreakModeWordWrap;
  184. JLBubbleManager *bubbleManager;
  185. if (msg.isGroup) {
  186. memberData *data = [[memberData alloc] init];
  187. data.roomId = msg.toId;
  188. data = [data getCardNameById:msg.fromUserId];
  189. if (data.bubbleFontId.length <= 0) {
  190. bubbleManager = [JLBubbleManager sharedManager];
  191. bubbleManager.id = @"0";
  192. }else {
  193. bubbleManager = [[JLBubbleManager sharedManager] fechGradeByBubbleFontId:data.bubbleFontId];
  194. }
  195. // NSLog(@"ID--%@---fromUserId%@--%@", data.bubbleFontId,self.msg.fromUserId,bubbleManager);
  196. }else {
  197. // 单聊
  198. // 从朋友表里获取
  199. JXUserObject *user;
  200. if (msg.isMySend) {
  201. user = [[JXUserObject sharedInstance] getUserById:MY_USER_ID];
  202. }else {
  203. user = [[JXUserObject sharedInstance] getUserById:msg.fromUserId];
  204. }
  205. bubbleManager = [[JLBubbleManager sharedManager] fechGradeByBubbleFontId:user.bubbleFontId];
  206. }
  207. if (bubbleManager == nil) {
  208. messageConent.font = [[JLBubbleManager sharedManager] getBubbleFontNameIndex:-1];
  209. messageConent.textColor = [[JLBubbleManager sharedManager] getBubbleFontColor:@""];
  210. }else {
  211. messageConent.font = [[JLBubbleManager sharedManager] getBubbleFontNameIndex:[bubbleManager.code intValue]];
  212. messageConent.textColor = [[JLBubbleManager sharedManager] getBubbleFontColor:bubbleManager.color];
  213. }
  214. messageConent.offset = -12;
  215. messageConent.frame = CGRectMake(0, 0, 200, 20);
  216. if ([msg.isReadDel boolValue] && [msg.fileName intValue] <= 0 && !msg.isMySend) {
  217. messageConent.text = [NSString stringWithFormat:@"%@ T", Localized(@"JX_ClickAndView")];
  218. }else {
  219. messageConent.text = msg.content;
  220. }
  221. if (msg.isGroup && !msg.isMySend) {
  222. n = messageConent.frame.size.height+10*3 + 27;
  223. if (msg.isShowTime) {
  224. n=messageConent.frame.size.height+10*3 + 40 + 20;
  225. }
  226. n += GROUP_CHAT_INSET;
  227. }else {
  228. n= messageConent.frame.size.height+10*3 + 10;
  229. if (msg.isShowTime) {
  230. n=messageConent.frame.size.height+10*3 + 40 + 10;
  231. }
  232. }
  233. // NSLog(@"heightForRowAtIndexPath_%d,%d:=%@",indexPath.row,n,_messageConent.text);
  234. if(n<55)
  235. n = 55+10;
  236. if (msg.isShowTime) {
  237. if(n<95)
  238. n = 95+10;
  239. }
  240. msg.chatMsgHeight = [NSString stringWithFormat:@"%f",n];
  241. if ([msg.content containsString:@"===jixinJXBigRellV"]){
  242. msg.chatMsgHeight = [NSString stringWithFormat:@"%f",n-20];
  243. }
  244. if (!msg.isNotUpdateHeight) {
  245. [msg updateChatMsgHeight];
  246. }
  247. // NSLog(@"高度%f--内容高度%f--内容%@", n, messageConent.frame.size.height,msg.content);
  248. return n;
  249. }
  250. -(void)didTouch:(UIButton*)button{
  251. if ([self.msg.isReadDel boolValue] && [self.msg.fileName intValue] <= 0 && !self.msg.isMySend) {
  252. [self.msg sendAlreadyReadMsg];
  253. self.msg.fileName = [NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]];
  254. [self.msg updateFileName];
  255. self.timeIndexLabel.hidden = NO;
  256. _messageConent.text = self.msg.content;
  257. // NSString *messageR = [self.msg.content stringByReplacingOccurrencesOfString:@"\r" withString:@""]; //去掉回车键
  258. // NSString *messageN = [messageR stringByReplacingOccurrencesOfString:@"\n" withString:@""]; //去掉回车键
  259. // NSString *messageText = [messageN stringByReplacingOccurrencesOfString:@" " withString:@""]; //去掉空格
  260. // CGSize size = [messageText boundingRectWithSize:CGSizeMake(_messageConent.frame.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:SYSFONT(g_constant.chatFont)} context:nil].size;
  261. // NSInteger count = size.height / _messageConent.font.lineHeight;
  262. // self.msg.fileName = [NSString stringWithFormat:@"%ld", count * 10];
  263. self.isDidMsgCell = YES;
  264. self.msg.chatMsgHeight = [NSString stringWithFormat:@"0"];
  265. [self.msg updateChatMsgHeight];
  266. [g_notify postNotificationName:kCellMessageReadDelNotifaction object:[NSNumber numberWithInt:self.indexNum]];
  267. // self.readDelTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerAction:) userInfo:nil repeats:YES];
  268. }
  269. }
  270. - (void)timerAction:(NSTimer *)timer {
  271. if (self.timerIndex <= 0) {
  272. [self.readDelTimer invalidate];
  273. self.readDelTimer = nil;
  274. self.msg.fileName = @"0";
  275. //阅后即焚通知
  276. [g_notify postNotificationName:kCellReadDelNotification object:self.msg];
  277. [self deleteMsg:self.msg];
  278. return;
  279. }
  280. self.timeIndexLabel.text = [NSString stringWithFormat:@"%ld",-- self.timerIndex];
  281. // self.msg.fileName = self.timeIndexLabel.text;
  282. // [self.msg updateFileName];
  283. }
  284. - (void)deleteMsg:(JXMessageObject *)msg{
  285. if ([self.msg.isReadDel boolValue]) {
  286. if ([self.msg.fileName intValue] > 0) {
  287. return;
  288. }
  289. //渐变隐藏
  290. [UIView animateWithDuration:2.f animations:^{
  291. self.bubbleBg.alpha = 0;
  292. self.timeIndexLabel.alpha = 0;
  293. self.readImage.alpha = 0;
  294. self.burnImage.alpha = 0;
  295. } completion:^(BOOL finished) {
  296. //动画结束后删除UI
  297. [self.delegate performSelectorOnMainThread:self.readDele withObject:msg waitUntilDone:NO];
  298. self.bubbleBg.alpha = 1;
  299. self.timeIndexLabel.alpha = 1;
  300. self.readImage.alpha = 1;
  301. self.burnImage.alpha = 1;
  302. }];
  303. }
  304. }
  305. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  306. [super setSelected:selected animated:animated];
  307. // Configure the view for the selected state
  308. }
  309. #pragma mark - 有表情的txt 转换成 含图片的str
  310. - (NSMutableAttributedString *)changeEmjoyText:(NSString *)text {
  311. NSMutableAttributedString *conStr = [[NSMutableAttributedString alloc] init];
  312. NSMutableArray *arr = [NSMutableArray array];
  313. [self getImageRange:text array:arr];
  314. if (arr.count > 1) {
  315. for (NSInteger i = 0; i < arr.count; i ++) {
  316. NSString *str = arr[i];
  317. NSInteger n;
  318. if ([str hasPrefix:@"["]&&[str hasSuffix:@"]"] && [g_faceVC.shortNameArrayE containsObject:str]) {
  319. n = [g_faceVC.shortNameArrayE indexOfObject:str];
  320. NSDictionary *dic = [g_constant.emojiArray objectAtIndex:n];
  321. EmojiTextAttachment *attachment = [[EmojiTextAttachment alloc] init];
  322. attachment.emojiTag = str;
  323. attachment.image = [UIImage imageNamed:dic[@"filename"]];
  324. attachment.bounds = CGRectMake(0, -4, 23, 23);
  325. [conStr appendAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
  326. }else {
  327. [conStr appendAttributedString:[[NSAttributedString alloc] initWithString:str attributes:@{NSFontAttributeName:self.messageConent.font}]];
  328. }
  329. }
  330. }else {
  331. return [[NSMutableAttributedString alloc] initWithString:text];
  332. }
  333. return conStr;
  334. }
  335. //将表情和文字分开,装进array
  336. -(void)getImageRange:(NSString*)message array: (NSMutableArray*)array {
  337. NSRange range=[message rangeOfString: @"["];
  338. NSRange range1=[message rangeOfString: @"]"];
  339. NSRange atRange = [message rangeOfString:@"@"];
  340. //判断当前字符串是否还有表情的标志。
  341. if (((range.length>0 && range1.length>0) || atRange.length>0) && range1.location > range.location) {
  342. if (range.length>0 && range1.length>0) {
  343. // self.contentEmoji = YES;
  344. // if (range.location > 0) {
  345. // [array addObject:[message substringToIndex:range.location]];
  346. // [array addObject:[message substringWithRange:NSMakeRange(range.location, range1.location+1-range.location)]];
  347. // NSString *str=[message substringFromIndex:range1.location+1];
  348. // [self getImageRange:str array:array];
  349. // }else {
  350. // NSString *nextstr=[message substringWithRange:NSMakeRange(range.location, range1.location+1-range.location)];
  351. // //排除文字是“”的
  352. // if (![nextstr isEqualToString:@""]) {
  353. // [array addObject:nextstr];
  354. // NSString *str=[message substringFromIndex:range1.location+1];
  355. // [self getImageRange:str array:array];
  356. // }else {
  357. // return;
  358. // }
  359. // }
  360. if (range.location > 0) {
  361. NSString *str = [message substringToIndex:range.location];
  362. NSString *str1 = [message substringFromIndex:range.location];
  363. [array addObject:str];
  364. [self getImageRange:str1 array:array];
  365. }else {
  366. NSString *emojiString = [message substringWithRange:NSMakeRange(range.location + 1, range1.location - 1)];
  367. BOOL isEmoji = NO;
  368. NSString *str;
  369. NSString *str1;
  370. for (NSMutableDictionary *dic in g_constant.emojiArray) {
  371. NSString *emoji = [dic objectForKey:@"english"];
  372. if ([emoji isEqualToString:emojiString]) {
  373. isEmoji = YES;
  374. break;
  375. }
  376. }
  377. if (isEmoji) {
  378. str = [message substringWithRange:NSMakeRange(range.location, range1.location + 1)];
  379. str1 = [message substringFromIndex:range1.location + 1];
  380. [array addObject:str];
  381. }else{
  382. NSString *posString = [message substringWithRange:NSMakeRange(range.location + 1, range1.location)];
  383. NSRange posRange = [posString rangeOfString:@"["];
  384. if (posRange.location != NSNotFound) {
  385. str = [message substringToIndex:posRange.location + 1];
  386. str1 = [message substringFromIndex:posRange.location + 1];
  387. [array addObject:str];
  388. }else{
  389. str = [message substringToIndex:range1.location + 1];
  390. str1 = [message substringFromIndex:range1.location + 1];
  391. [array addObject:str];
  392. }
  393. }
  394. [self getImageRange:str1 array:array];
  395. }
  396. } else if (atRange.length>0) {
  397. if (atRange.location > 0) {
  398. [array addObject:[message substringToIndex:atRange.location]];
  399. [array addObject:[message substringWithRange:NSMakeRange(atRange.location, 1)]];
  400. NSString *str=[message substringFromIndex:atRange.location+1];
  401. [self getImageRange:str array:array];
  402. }else{
  403. [array addObject:[message substringWithRange:NSMakeRange(atRange.location, 1)]];
  404. NSString *str=[message substringFromIndex:atRange.location+1];
  405. [self getImageRange:str array:array];
  406. }
  407. }else if (message != nil) {
  408. [array addObject:message];
  409. }
  410. }
  411. else if (range.length>0 && range1.length>0 && range1.location < range.location){
  412. NSString *str = [message substringToIndex:range1.location + 1];
  413. NSString *str1 = [message substringFromIndex:range1.location + 1];
  414. [array addObject:str];
  415. [self getImageRange:str1 array:array];
  416. }
  417. else if (message != nil) {
  418. [array addObject:message];
  419. }
  420. }
  421. @end