ChatKit-OC icon indicating copy to clipboard operation
ChatKit-OC copied to clipboard

圆角性能问题

Open siperman opened this issue 8 years ago • 3 comments

Base Info for this issue

圆角性能问题

  1. ChatKit Version:0.7.20
  2. App-ID: XX
  3. Language:Objective-C
  4. iOS System Version:iOS10
  5. Prototype(是否是真机):YES
  6. Issue Type:Bug、

1. How to repeat the problem.

LCCKChatMessageCell cell中源码当开启圆角时CPU飙升不下(6s机器占用98+,且界面绘制完成不下降), LCCKAvatarImageViewCornerRadiusBlock avatarImageViewCornerRadiusBlock = [LCChatKit sharedInstance].avatarImageViewCornerRadiusBlock; if (avatarImageViewCornerRadiusBlock) { CGSize avatarImageViewSize = CGSizeMake(kAvatarImageViewWidth, kAvatarImageViewHeight); CGFloat avatarImageViewCornerRadius = avatarImageViewCornerRadiusBlock(avatarImageViewSize); self.avatarImageView.lcck_cornerRadius = avatarImageViewCornerRadius; } 在instrument中仔细查找关键原因 self.avatarImageView.lcck_cornerRadius = avatarImageViewCornerRadius; 所执行的代码占绝大部分资源,改为 _avatarImageView.layer.cornerRadius = avatarImageViewCornerRadius; _avatarImageView.clipsToBounds = YES; CPU下降为30左右,绘制完成CPU资源释放。

建议改下

siperman avatar Nov 21 '16 07:11 siperman

self.avatarImageView.lcck_cornerRadius主要是在做圆角的异步渲染,使用GCD的global的方式进行异步渲染。但是,我推测主要是没考虑到线程切换的代价。后期优化下。

ChenYilong avatar Jan 11 '17 07:01 ChenYilong

关于头像圆角这个问题 现在仍然存在 0.8.16 并且我更新到0.9.0最新版以后 提示LCCKConstants的第155行 static AVIMMessageMediaType const kAVIMMessageMediaTypeSystem = -7; 这句话报错

ConnyYue avatar Jun 02 '17 03:06 ConnyYue

fix in CYLChatKit https://github.com/ChenYilong/CYLChatKit/releases

changelog:

version 2.1.1 update voice message send UI same to wechat

ChenYilong avatar Jun 14 '18 18:06 ChenYilong