This repository has been archived by the owner on Oct 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
149 changed files
with
7,299 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// RCDContactSelectedCollectionViewCell.h | ||
// RCloudMessage | ||
// | ||
// Created by Jue on 2016/10/20. | ||
// Copyright © 2016年 RongCloud. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "RCDUserInfo.h" | ||
|
||
@interface RCDContactSelectedCollectionViewCell : UICollectionViewCell | ||
|
||
@property(nonatomic, strong) UIImageView *ivAva; | ||
|
||
- (void)setUserModel:(RCUserInfo *)userModel; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// RCDContactSelectedCollectionViewCell.m | ||
// RCloudMessage | ||
// | ||
// Created by Jue on 2016/10/20. | ||
// Copyright © 2016年 RongCloud. All rights reserved. | ||
// | ||
|
||
#import "RCDContactSelectedCollectionViewCell.h" | ||
#import "DefaultPortraitView.h" | ||
#import "UIImageView+WebCache.h" | ||
|
||
@implementation RCDContactSelectedCollectionViewCell | ||
|
||
- (instancetype)initWithFrame:(CGRect)frame { | ||
if (self = [super initWithFrame:frame]) { | ||
_ivAva = [[UIImageView alloc] initWithFrame:CGRectZero]; | ||
_ivAva.clipsToBounds = YES; | ||
_ivAva.layer.cornerRadius = 5.f; | ||
_ivAva.translatesAutoresizingMaskIntoConstraints = NO; | ||
[_ivAva setBackgroundColor:[UIColor clearColor]]; | ||
[self.contentView addSubview:_ivAva]; | ||
|
||
[self.contentView | ||
addConstraints: | ||
[NSLayoutConstraint | ||
constraintsWithVisualFormat:@"H:|[_ivAva]|" | ||
options:kNilOptions | ||
metrics:nil | ||
views:NSDictionaryOfVariableBindings( | ||
_ivAva)]]; | ||
|
||
[self.contentView | ||
addConstraints: | ||
[NSLayoutConstraint | ||
constraintsWithVisualFormat:@"V:|[_ivAva]|" | ||
options:kNilOptions | ||
metrics:nil | ||
views:NSDictionaryOfVariableBindings( | ||
_ivAva)]]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)setUserModel:(RCUserInfo *)userModel { | ||
self.ivAva.image = nil; | ||
if ([userModel.portraitUri isEqualToString:@""]) { | ||
DefaultPortraitView *defaultPortrait = | ||
[[DefaultPortraitView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; | ||
[defaultPortrait setColorAndLabel:userModel.userId Nickname:userModel.name]; | ||
UIImage *portrait = [defaultPortrait imageFromView]; | ||
self.ivAva.image = portrait; | ||
} else { | ||
[self.ivAva sd_setImageWithURL:[NSURL URLWithString:userModel.portraitUri] | ||
placeholderImage:[UIImage imageNamed:@"icon_person"]]; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.