Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

关于对话页面头像圆角问题的解决方案 #348

Open
kuopenx opened this issue Sep 9, 2017 · 1 comment
Open

关于对话页面头像圆角问题的解决方案 #348

kuopenx opened this issue Sep 9, 2017 · 1 comment

Comments

@kuopenx
Copy link

kuopenx commented Sep 9, 2017

Base Info for this issue

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

1. How to repeat the problem.

1)已经设置了头像圆角的block方法,可是运行时发现在对话页面头像圆角并没有生效,但是经过再次刷新cell(拖到屏幕外再松手)圆角会生效,最近联系人页面的头像没有这个问题。

2)再就是chatkit内部设置的圆角方法回导致刷新页面时图片出现闪动(体验不是很好,但还可以接受),提一下

3)_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;//防止特别长或者宽的图片显示不正常,防止图像太长会超出bounds,建议设置成此样式

2. Please help me in this way.

发现问题所在是头像设置圆角有个前提:frame不能是0,在设置了frame之后,圆角才能生效,亲测有效,可以在设置圆角代码前加上一句设置imageView.frame = CGRectMake(0, 0, 50, 50);

3. Here is a Demo.

  • (UIImageView *)avatarImageView {
    if (!_avatarImageView) {
    _avatarImageView = [[UIImageView alloc] init];
    // _avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
    _avatarImageView.contentMode = UIViewContentModeScaleAspectFill;//防止特别长或者宽的图片显示不正常
    LCCKAvatarImageViewCornerRadiusBlock avatarImageViewCornerRadiusBlock = [LCChatKit sharedInstance].avatarImageViewCornerRadiusBlock;
    if (avatarImageViewCornerRadiusBlock) {
    CGSize avatarImageViewSize = CGSizeMake(kAvatarImageViewWidth, kAvatarImageViewHeight);
    CGFloat avatarImageViewCornerRadius = avatarImageViewCornerRadiusBlock(avatarImageViewSize);
    // self.avatarImageView.lcck_cornerRadius = avatarImageViewCornerRadius;
    _avatarImageView.frame = CGRectMake(0, 0, kAvatarImageViewWidth, kAvatarImageViewHeight);//这一句代码是我后来加上的,可以使圆角立刻生效
    _avatarImageView.lcck_cornerRadius = avatarImageViewCornerRadius;
    }
    [self bringSubviewToFront:_avatarImageView];
    }
    return _avatarImageView;

4. Here is my Debug log

@ChenYilong
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants