iOS集成EaseUI3.0 使用方式 单聊 群聊 表情
2016-08-15 10:18
393 查看
EaseUI3.0 使用方式
快速集成
第 1步:集成 EaseUI前,首先需要集成环信 iOS SDK,参考:集成文档。
第 2 步:参考ChatDemo3.0导入的方式,直接将EaseUI拖入已经集成SDK的项目中
初始化
第 1步:引入相关头文件 #import “EaseUI.h”。
第 2 步:在工程的 AppDelegate中的以下方法中,调用 EaseUI对应方法。
[[EaseSDKHelper
shareHelper] hyphenateApplication:application
didFinishLaunchingWithOptions:launchOptions
appkey:@"panadalove#yuwan20160719"
apnsCertName:@""
otherConfig:@{kSDKConfigEnableConsoleLogger:[NSNumbernumberWithBool:YES]}];
集成单聊,和聊天室
-(void)roomchat
{
EaseMessageViewController *chatController = [[EaseMessageViewControlleralloc]initWithConversationChatter:@"229351175885947308"conversationType:EMConversationTypeChatRoom];
chatController.title=@"testgroup1";
chatController.dataSource=self;
[self.navigationControllerpushViewController:chatControlleranimated:YES];
}
- (void)chat
{
EaseMessageViewController* emVC = [[EaseMessageViewControlleralloc]initWithConversationChatter:@"8004"conversationType:EMConversationTypeChat];
emVC.title =
@"小坏蛋";
emVC.dataSource=self;
[self.navigationControllerpushViewController:emVCanimated:YES];
}
需要实现<EaseMessageViewControllerDataSource>协议
//实现协议,自定义用户头像和昵称
- (id<IMessageModel>)messageViewController:(EaseMessageViewController*)viewController
modelForMessage:(EMMessage*)message
{
id<IMessageModel> model =nil;
model = [[EaseMessageModelalloc]initWithMessage:message];
model.avatarImage = [UIImageimageNamed:@"EaseUIResource.bundle/user"];//默认头像
model.avatarURLPath =
@"";//头像网络地址
model.nickname =
@"昵称";//用户昵称
return model;
}
集成表情
在EaseMessageViewController.m文件的viewDidLoad结束前添加
EaseEmotionManager * manager = [[EaseEmotionManageralloc]initWithType:EMEmotionDefaultemotionRow:3emotionCol:7emotions:[EaseEmojiallEmoji]];
[self.faceViewsetEmotionManagers:@[manager]];
不需要集成实时语音通话和视频通话的项目中去除语音通话和视频通话的图标
删除EaseChatBarMoreView.m文件中
//语音通话和视频通话
// _audioCallButton =[UIButtonbuttonWithType:UIButtonTypeCustom];
// [_audioCallButtonsetFrame:CGRectMake(insets * 4 + CHAT_BUTTON_SIZE * 3, 10, CHAT_BUTTON_SIZE ,CHAT_BUTTON_SIZE)];
// [_audioCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_audioCall"]forState:UIControlStateNormal];
// [_audioCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_audioCallSelected"]forState:UIControlStateHighlighted];
// [_audioCallButton addTarget:selfaction:@selector(takeAudioCallAction) forControlEvents:UIControlEventTouchUpInside];
// _audioCallButton.tag =MOREVIEW_BUTTON_TAG + 3;
// [_scrollviewaddSubview:_audioCallButton];
//
// _videoCallButton =[UIButtonbuttonWithType:UIButtonTypeCustom];
9f2d
// [_videoCallButtonsetFrame:CGRectMake(insets, 10 * 2 + CHAT_BUTTON_SIZE + 10, CHAT_BUTTON_SIZE ,CHAT_BUTTON_SIZE)];
// [_videoCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_videoCall"]forState:UIControlStateNormal];
// [_videoCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_videoCallSelected"]forState:UIControlStateHighlighted];
// [_videoCallButton addTarget:selfaction:@selector(takeVideoCallAction) forControlEvents:UIControlEventTouchUpInside];
// _videoCallButton.tag=MOREVIEW_BUTTON_TAG + 4;
// _maxIndex = 4;
// [_scrollview addSubview:_videoCallButton];
快速集成
第 1步:集成 EaseUI前,首先需要集成环信 iOS SDK,参考:集成文档。
第 2 步:参考ChatDemo3.0导入的方式,直接将EaseUI拖入已经集成SDK的项目中
初始化
第 1步:引入相关头文件 #import “EaseUI.h”。
第 2 步:在工程的 AppDelegate中的以下方法中,调用 EaseUI对应方法。
[[EaseSDKHelper
shareHelper] hyphenateApplication:application
didFinishLaunchingWithOptions:launchOptions
appkey:@"panadalove#yuwan20160719"
apnsCertName:@""
otherConfig:@{kSDKConfigEnableConsoleLogger:[NSNumbernumberWithBool:YES]}];
集成单聊,和聊天室
-(void)roomchat
{
EaseMessageViewController *chatController = [[EaseMessageViewControlleralloc]initWithConversationChatter:@"229351175885947308"conversationType:EMConversationTypeChatRoom];
chatController.title=@"testgroup1";
chatController.dataSource=self;
[self.navigationControllerpushViewController:chatControlleranimated:YES];
}
- (void)chat
{
EaseMessageViewController* emVC = [[EaseMessageViewControlleralloc]initWithConversationChatter:@"8004"conversationType:EMConversationTypeChat];
emVC.title =
@"小坏蛋";
emVC.dataSource=self;
[self.navigationControllerpushViewController:emVCanimated:YES];
}
需要实现<EaseMessageViewControllerDataSource>协议
//实现协议,自定义用户头像和昵称
- (id<IMessageModel>)messageViewController:(EaseMessageViewController*)viewController
modelForMessage:(EMMessage*)message
{
id<IMessageModel> model =nil;
model = [[EaseMessageModelalloc]initWithMessage:message];
model.avatarImage = [UIImageimageNamed:@"EaseUIResource.bundle/user"];//默认头像
model.avatarURLPath =
@"";//头像网络地址
model.nickname =
@"昵称";//用户昵称
return model;
}
集成表情
在EaseMessageViewController.m文件的viewDidLoad结束前添加
EaseEmotionManager * manager = [[EaseEmotionManageralloc]initWithType:EMEmotionDefaultemotionRow:3emotionCol:7emotions:[EaseEmojiallEmoji]];
[self.faceViewsetEmotionManagers:@[manager]];
不需要集成实时语音通话和视频通话的项目中去除语音通话和视频通话的图标
删除EaseChatBarMoreView.m文件中
//语音通话和视频通话
// _audioCallButton =[UIButtonbuttonWithType:UIButtonTypeCustom];
// [_audioCallButtonsetFrame:CGRectMake(insets * 4 + CHAT_BUTTON_SIZE * 3, 10, CHAT_BUTTON_SIZE ,CHAT_BUTTON_SIZE)];
// [_audioCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_audioCall"]forState:UIControlStateNormal];
// [_audioCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_audioCallSelected"]forState:UIControlStateHighlighted];
// [_audioCallButton addTarget:selfaction:@selector(takeAudioCallAction) forControlEvents:UIControlEventTouchUpInside];
// _audioCallButton.tag =MOREVIEW_BUTTON_TAG + 3;
// [_scrollviewaddSubview:_audioCallButton];
//
// _videoCallButton =[UIButtonbuttonWithType:UIButtonTypeCustom];
9f2d
// [_videoCallButtonsetFrame:CGRectMake(insets, 10 * 2 + CHAT_BUTTON_SIZE + 10, CHAT_BUTTON_SIZE ,CHAT_BUTTON_SIZE)];
// [_videoCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_videoCall"]forState:UIControlStateNormal];
// [_videoCallButton setImage:[UIImageimageNamed:@"EaseUIResource.bundle/chatBar_colorMore_videoCallSelected"]forState:UIControlStateHighlighted];
// [_videoCallButton addTarget:selfaction:@selector(takeVideoCallAction) forControlEvents:UIControlEventTouchUpInside];
// _videoCallButton.tag=MOREVIEW_BUTTON_TAG + 4;
// _maxIndex = 4;
// [_scrollview addSubview:_videoCallButton];
相关文章推荐
- iOS集成EaseUI3.0 使用方式 单聊 群聊 表情 去掉音视频按钮
- ios集成环信 easeUI SDK 3.0 SDK 2.0 出错遇到的所有问题
- iOS环信3.0集成 (二)UI文件集成
- iOS UI基础-3.0图片浏览器及plist使用
- 环信 Ease3.0SDK 与EaseUI3.0 集成汇总 (卡壳的朋友们可以看看,已顺利集成成功)
- IOS 不集成SDK使用URL方式打开地图导航 谷歌 百度 高德
- iOS 集成环信UI3.0
- iOS开发入门之UIPickerView控件的简单使用
- IOS学习之UIPickerView控件的简单使用
- iOS学习之UIPickerView控件的简单使用
- 使用命令行实现iOS持续集成
- iOS开发中使用[[UIApplication sharedApplication] openURL:] 加载其它应用
- ADO.NET使用集成方式连接
- 持续集成实践:使用Visual Studio 2010 Coded UI Test 制作能自动安装/卸载UI应用的程序
- IOS使用MessageUI Framework 发送邮件
- iOS学习之UIPickerView控件的简单使用
- 关于spring与struts2使用Annotion注解方式的集成
- IOS学习之UIPickerView控件的简单使用
- iOS自带表情图标,可用转义字符使用
- IOS UIPickerView使用