美文网首页环信
1.环信(V3.3.5(2017-10-24)以前版本)聊天界面

1.环信(V3.3.5(2017-10-24)以前版本)聊天界面

作者: 淡闲星草 | 来源:发表于2017-10-26 18:01 被阅读43次

1.iPhoneX 宏定义

#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define iOS11 ([[UIDevice currentDevice].systemVersion doubleValue] >= 11.0)

2.聊天界面适配

#import "EaseMessageViewController.h"

//1.添加chatToolbar是否展开判定
//是否已经隐藏底部tool

@property (nonatomic, assign) BOOL isHiddenChatTool; 

//2.此处判定 主要是针对 有聊天数据的时候,最底部cell被chatToolbar遮挡问题

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    self.isViewDidAppear = YES;
    [[EaseSDKHelper shareHelper] setIsShowingimagePicker:NO];
    
    if (self.scrollToBottomWhenAppear) {
        [self _scrollViewToBottom:NO];
    }
    self.scrollToBottomWhenAppear = YES;
    
 //3.针对 ipnoneX 的适配
    if (iPhoneX) {
        //1.table
        [UIView animateWithDuration:0.3 animations:^{
            CGRect rect = self.tableView.frame;
            rect.origin.y = 0;
            rect.size.height = self.view.frame.size.height - 46;
            rect.size.height = self.view.frame.size.height - 46 - 20;
            self.tableView.frame = rect;
        }];
        [self _scrollViewToBottom:NO];
   
        //2.chatToolbar
        self.chatToolbar.frame = CGRectMake(0, self.view.frame.size.height - [EaseChatToolbar defaultHeight]-20, self.view.frame.size.width, [EaseChatToolbar defaultHeight]+20);
    }
}

3.主要是 发送消息后 有关界面处理

#pragma mark - GestureRecognizer
//点击 手势 隐藏键盘
-(void)keyBoardHidden:(UITapGestureRecognizer *)tapRecognizer
{
    if (iPhoneX) {
      self.isHiddenChatTool = YES;
    }
    
    if (tapRecognizer.state == UIGestureRecognizerStateEnded) {
        [self.chatToolbar endEditing:YES];
        if (iPhoneX) {
            self.chatToolbar.frame = CGRectMake(0, self.view.frame.size.height - [EaseChatToolbar defaultHeight]-20, self.view.frame.size.width, [EaseChatToolbar defaultHeight]+20);

        }
        
    }
}
#pragma mark - EMChatToolbarDelegate
//监听chatBarTool  frame变化
- (void)chatToolbarDidChangeFrameToHeight:(CGFloat)toHeight
{
    [UIView animateWithDuration:0.3 animations:^{
        CGRect rect = self.tableView.frame;
       
        rect.origin.y = 0;
        rect.size.height = self.view.frame.size.height - toHeight;
        if (self.isHiddenChatTool == YES && iPhoneX) {
            rect.size.height = self.view.frame.size.height - toHeight - 20;
        }
  
        self.tableView.frame = rect;
    }];
    
    [self _scrollViewToBottom:NO];
}

//即将开始 输入送信息监听
- (void)inputTextViewWillBeginEditing:(EaseTextView *)inputTextView
{
    if (iPhoneX ) {
       self.isHiddenChatTool = NO;
    }
    
    if (_menuController == nil) {
        _menuController = [UIMenuController sharedMenuController];
    }
    [_menuController setMenuItems:nil];
}

4.输入信息后 刷新界面 感觉刷新多次错乱问题

主要是 针对 iOS11的UITableView 适配

#import "EaseRefreshTableViewController.h"
- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
        [self setEdgesForExtendedLayout:UIRectEdgeNone];
    }
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:self.style];
    _tableView.accessibilityIdentifier = @"table_view";
    _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.tableFooterView = self.defaultFooterView;
    [self.view addSubview:_tableView];
    
    if (iOS11) {
        _tableView.estimatedRowHeight = 0;
        _tableView.estimatedSectionHeaderHeight = 0;
        _tableView.estimatedSectionFooterHeight = 0;
       
    }
    _page = 0;
    _showRefreshHeader = NO;
    _showRefreshFooter = NO;
    _showTableBlankView = NO;
}

相关文章

  • 1.环信(V3.3.5(2017-10-24)以前版本)聊天界面

    1.iPhoneX 宏定义 2.聊天界面适配 //1.添加chatToolbar是否展开判定//是否已经隐藏底部t...

  • 环信聊天室demo

    开发一个直播项目需要用到环信聊天室,折腾后自己集成环信聊天不带语音版本,集成环信UI删减一些不要的东西1.需要在x...

  • 微信搜索长按文字方案

    微信聊天界面长按文字搜索方案 一、当前版本概况 当前版本的微信版本在聊天界面不能长按文字直接对文字进行搜索的功能。...

  • iOS环信聊天界面,URL处理

    环信聊天界面,如果是超链接,目前版本是不支持打开的,之前是有版本支持的,这个属于UI层,需要我们自己处理; 思路 ...

  • IPV6适配之环信SDK

    项目中集成了环信,在IPV6 下无法登录环信的聊天服务器,无法聊天,因此需要适配环信 ,去年7月集成的版本应该是...

  • 03_环信集成 app 即时通讯功能基础-好友列表

    即时通讯功能的相关界面主要就是会话列表界面,好友列表界面和聊天界面。下面先介绍下好友列表界面的相关环信 API 方...

  • 做环信聊天室遇到的坑

    1.加入聊天室 修改EaseUI提供的界面(1)发送人接收人的消息都在左侧:a.自定义展示消息的cell集成自环信...

  • 环信实现聊天界面查看大图左右轮滑效果

    环信提供了一个easeUI库,其中实现了一些简单的聊天界面。但是产品需求却是要我们能够在聊天界面中点击图片,并且可...

  • 环信3.0使用归纳

    环信聊天界面的自定义输入框 注册、添加需要显示的选项,如:拍照,图片等,环信默认是三个 更多需在子类重写添加 添加...

  • iXShot样张

    测试机型iPhone SE 1.微信朋友圈支持朋友圈界面的拼接 2.微信好友列表 3.微信聊天界面2 4.微信聊天...

网友评论

  • imGeek:适配已做好,就差一个iPhone X了。

本文标题:1.环信(V3.3.5(2017-10-24)以前版本)聊天界面

本文链接:https://www.haomeiwen.com/subject/grvkpxtx.html