ChatKit-OC
ChatKit-OC copied to clipboard
圆角性能问题
Base Info for this issue
圆角性能问题
- ChatKit Version:0.7.20
- App-ID: XX
- Language:Objective-C
- iOS System Version:iOS10
- Prototype(是否是真机):YES
- 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资源释放。
建议改下
self.avatarImageView.lcck_cornerRadius主要是在做圆角的异步渲染,使用GCD的global的方式进行异步渲染。但是,我推测主要是没考虑到线程切换的代价。后期优化下。
关于头像圆角这个问题 现在仍然存在 0.8.16 并且我更新到0.9.0最新版以后 提示LCCKConstants的第155行 static AVIMMessageMediaType const kAVIMMessageMediaTypeSystem = -7; 这句话报错
fix in CYLChatKit https://github.com/ChenYilong/CYLChatKit/releases
changelog:
version 2.1.1 update voice message send UI same to wechat