更改环信UI流程

前言:使用环信UI时需要显示用户的昵称、头像、点击头像进入用户主页。但是有的地方需要直接更改环信UI源码,使用cocoapods误更新环信UI时,源码更改的部分被覆盖。日狗两次,现记录更改流程,以备第三次。。。


1,在EaseMessageViewController.h中添加三个属性

#pragma mark -进入聊天界面时需要的用户昵称,头像,ID @property(nonatomic,strong)NSString*otherUserNick;

@property(nonatomic,strong)NSString*otherUserPic;

@property(nonatomic,strong)NSString*otherUserID;

2,在EaseMessageViewController.m中

- (void)_sendMessage:(EMMessage*)message;方法中增加消息扩展

NSUserDefaults*d = [NSUserDefaultsstandardUserDefaults];

NSMutableDictionary*dic = [NSMutableDictionarydictionaryWithDictionary:message.ext];

dic[@"otherUserId"] =self.otherUserID;

dic[@"otherUserPic"] =self.otherUserPic;

dic[@"otherUserNick"] =self.otherUserNick;

dic[@"userId"] = [dobjectForKey:@"userId"];

dic[@"userPic"] = [dobjectForKey:@"userPic"];

dic[@"userNick"] = [dobjectForKey:@"userNick"];

message.ext= dic;

3,更改聊天气泡的颜色(EaseMessageViewController.m中)

- (void)viewDidLoad ;方法中更改聊天气泡颜色

[[EaseBaseMessageCellappearance]setSendBubbleBackgroundImage:[[UIImageimageNamed:@"bubbleSen"]stretchableImageWithLeftCapWidth:5topCapHeight:35]];

4,隐藏输入框中的录音按钮(EaseChatToolbar.h中)

- (void)_setupSubviews;方法中注释掉

//change input type

UIButton*styleChangeButton = [[UIButtonalloc]init];

styleChangeButton.accessibilityIdentifier=@"style";

styleChangeButton.autoresizingMask=UIViewAutoresizingFlexibleTopMargin;

[styleChangeButtonsetImage:[UIImageeaseImageNamed:@"EaseUIResource.bundle/chatBar_record"]forState:UIControlStateNormal];

[styleChangeButtonsetImage:[UIImageeaseImageNamed:@"EaseUIResource.bundle/chatBar_keyboard"]forState:UIControlStateSelected];

[styleChangeButtonaddTarget:selfaction:@selector(styleButtonAction:)forControlEvents:UIControlEventTouchUpInside];

EaseChatToolbarItem*styleItem = [[EaseChatToolbarItemalloc]initWithButton:styleChangeButtonwithView:nil];

[selfsetInputViewLeftItems:@[styleItem]];   


5,修改消息列表中的头像圆角(EaseImageView.h中)

- (void)_setupSubviews;方法中

_imageView.layer.cornerRadius=20;//设置头像圆角 (cell 高度 为 60 减去上下间距20,然后除以2)   

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容