新浦京81707con > 软件下载 > 澳门葡京真人赌场环信聊天自定义消息列表以及

原标题:澳门葡京真人赌场环信聊天自定义消息列表以及

浏览次数:147 时间:2020-04-06

1、在对话(EaseConversationListViewController)列表踏向闲聊分界面时,头像和小名的拍卖。首先要取获得对方发送的扩大音信ext,然后通过字典好朋友的ID作为key存在当地。

近来在弄环信,以为接入只怕相比较便于的,网络海高校把课程,就不赘述了。不过前面依照必要的修正相比核查耐心。。。

第一点: easeUI集成应用其实轻松比非常多居多,里面也卷入了关于头像别称的设置,所急需做的只是把代理方法实现,前提是你的闲聊页面等都是世襲easeUI里面包车型地铁相干的类去做的。1.闲谈页面:

澳门葡京真人赌场 113CF2825-D042-4A2E-9831-1649615AD568.png

自家不精通外人怎么跑的官方demo,反正作者是没跑起来。。不过没啥关系啊,轻易说下布局咯,相信您本身也看收获:


 NSLog(@"获取扩展信息 -- %@",model.conversation.lastReceivedMessage.ext); NSLog(@"好友的ID----%@",model.conversation.conversationId); NSDictionary *dic = [NSDictionary dictionaryWithDictionary:model.conversation.lastReceivedMessage.ext]; NSDictionary *otherInfo = @{@"avatar":dic[@"avatar"],@"nickname":dic[@"nick"]}; [NSUSERDEFAULTS setObject:otherInfo forKey: model.conversation.conversationId]; [NSUSERDEFAULTS synchronize];

澳门葡京真人赌场 2

- (id)messageViewController:(EaseMessageViewController *)viewController

2、在闲谈类(EaseMessageViewController卡塔尔(قطر‎对扩大消息实行拍卖。// 定义全局属性

是否很简短,比较懒,就没拖在周围地点,有失眠的勿怪。大家要看的大约便是那些新闻列表和闲谈页面了。

modelForMessage:(EMMessage *)message

 NSString *friendMsgHdImvUrl;//对方 - 发送信息的 - 头像 - 下载链接 NSString *friendMsgNickName;//对方 - 发送信息的 - 昵称

笔者是友善写的一个消息列表页面,英特网有的直接用的EaseConversationListViewController,也是有世袭三个EaseConversationListViewController的,其实都足以,因为一以前本人就本人写了,前边就懒得改了。贴一点自己要好的代码:

澳门葡京真人赌场 3

管理新闻

澳门葡京真人赌场 4

上海教室是自身修改后的代码示例,头像和小名都以写死的,而你的应当是从服务器获取大概音信的扩张中取获得的,当然最棒是提前保存在本土,从地点得到,那样就可以实现立异头像后历史的头像也会更新。

澳门葡京真人赌场 5CB8C1482-C53C-4FA9-B11A-93F0158E21A6.png

率先,据守有关的代办,有群组闲谈的还要增添EMGroupManagerDelegate,并落到实处- didUpdateGroupList:(NSArray *)groupList方法。

其次点:会话列表

-setNavTitle:(NSString *)title{ NSDictionary *InfoDic = [NSUSERDEFAULTS valueForKey:title]; NSLog(@"信息:%@",InfoDic); friendMsgHdImvUrl = InfoDic[@"avatar"];//对方 - 发送信息的 - 头像 - 下载链接 friendMsgNickName = InfoDic[@"nickname"];//对方 - 发送信息的 - 昵称 self.title = friendMsgNickName;}

澳门葡京真人赌场 6


- (NSArray *)formatMessages:(NSArray *State of Qatarmessages的点子管理

下一场在viewWillAppear里,要求登记音信通知,记得viewWillDisAppear里注销咯~

-(id)conversationListViewController(EaseConversationListViewController*)

#pragma mark - public- (NSArray *)formatMessages:(NSArray *)messages{ NSMutableArray *formattedArray = [[NSMutableArray alloc] init]; if ([messages count] == 0) { return formattedArray; } for (EMMessage *message in messages) { //Calculate time interval CGFloat interval = (self.messageTimeIntervalTag - message.timestamp) / 1000; if (self.messageTimeIntervalTag < 0 || interval > 60 || interval < -60) { NSDate *messageDate = [NSDate dateWithTimeIntervalInMilliSecondSince1970:(NSTimeInterval)message.timestamp]; NSString *timeStr = @""; if (_dataSource && [_dataSource respondsToSelector:@selector(messageViewController:stringForDate:)]) { timeStr = [_dataSource messageViewController:self stringForDate:messageDate]; } else{ timeStr = [messageDate formattedTime]; } [formattedArray addObject:timeStr]; self.messageTimeIntervalTag = message.timestamp; } //Construct message model id<IMessageModel> model = nil; if (_dataSource && [_dataSource respondsToSelector:@selector(messageViewController:modelForMessage:)]) { model = [_dataSource messageViewController:self modelForMessage:message]; } else{ model = [[EaseMessageModel alloc] initWithMessage:message]; NSString *loginUserName = [[EMClient sharedClient] currentUsername]; if ([model.message.from isEqualToString:loginUserName]) { // model.avatarImage = [UIImage imageNamed:@"EaseUIResource.bundle/user"]; model.avatarURLPath = [NSUSERDEFAULTS valueForKey:kUserIcon]; model.failImageName = @"imageDownloadFail"; model.nickname = [NSString stringWithFormat:@"%@",[NSUSERDEFAULTS valueForKey:kUserName]] ; } else{ NSString *avatarURLPathStr =friendMsgHdImvUrl; model.failImageName = @"imageDownloadFail"; if (avatarURLPathStr == nil ||avatarURLPathStr == NULL) { model.avatarImage = [UIImage imageNamed:@"EaseUIResource.bundle/user"]; }else{ model.avatarURLPath = friendMsgHdImvUrl; } NSString *nicknameStr = friendMsgNickName; NSLog(@"2昵称 --- %@",nicknameStr); if (nicknameStr == nil || nicknameStr == NULL) { }else{ model.nickname =[NSString stringWithFormat:@"%@",friendMsgNickName]; } } } if  { [formattedArray addObject:model]; } } return formattedArray;}

澳门葡京真人赌场 7

conversationListViewController  modelForConversation:(EMConversation *)conversation

本文由新浦京81707con发布于软件下载,转载请注明出处:澳门葡京真人赌场环信聊天自定义消息列表以及

关键词: 新浦京81707con ios 自定义 头像 昵称

上一篇:小朋友学C语言,scanf以及缓冲区

下一篇:没有了