消息列表-好友派对中
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 9.1 KiB |
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "session_list_head_friend@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "session_list_head_friend@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 8.5 KiB |
@@ -8,12 +8,15 @@
|
|||||||
#import "XPSessionListHeadFriendCell.h"
|
#import "XPSessionListHeadFriendCell.h"
|
||||||
#import <Masonry/Masonry.h>
|
#import <Masonry/Masonry.h>
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
|
#import "NetImageView.h"
|
||||||
|
#import "UIImage+Utils.h"
|
||||||
|
|
||||||
@interface XPSessionListHeadFriendCell()
|
@interface XPSessionListHeadFriendCell()
|
||||||
|
|
||||||
@property (nonatomic, strong) UILabel *nameLabel;
|
@property (nonatomic, strong) UILabel *nameLabel;
|
||||||
@property (nonatomic, strong) UIImageView *imageView;
|
@property (nonatomic, strong) NetImageView *imageView;
|
||||||
@property (nonatomic, strong) UIView *dotView;
|
@property (nonatomic, strong) UIImageView *dotView;
|
||||||
|
@property (nonatomic, strong) UIImageView *genderImageView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -28,25 +31,30 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)initView {
|
- (void)initView {
|
||||||
[self addSubview:self.imageView];
|
|
||||||
[self addSubview:self.nameLabel];
|
|
||||||
[self addSubview:self.dotView];
|
[self addSubview:self.dotView];
|
||||||
|
[self addSubview:self.imageView];
|
||||||
|
[self addSubview:self.genderImageView];
|
||||||
|
[self addSubview:self.nameLabel];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initContraints {
|
- (void)initContraints {
|
||||||
|
[self.dotView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.top.mas_equalTo(12);
|
||||||
|
make.left.mas_equalTo(self);
|
||||||
|
make.width.height.mas_equalTo(48);
|
||||||
|
}];
|
||||||
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.centerX.mas_equalTo(0);
|
make.centerX.centerY.mas_equalTo(self.dotView);
|
||||||
make.width.height.mas_equalTo(50);
|
make.width.height.mas_equalTo(44);
|
||||||
}];
|
}];
|
||||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.centerX.bottom.mas_equalTo(0);
|
make.centerX.mas_equalTo(self);
|
||||||
make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(8);
|
make.top.mas_equalTo(self.dotView.mas_bottom).mas_offset(2);
|
||||||
make.bottom.mas_equalTo(0);
|
|
||||||
make.height.mas_equalTo(17);
|
make.height.mas_equalTo(17);
|
||||||
}];
|
}];
|
||||||
[self.dotView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.genderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.right.mas_equalTo(self.imageView);
|
make.right.bottom.mas_equalTo(self.dotView);
|
||||||
make.width.height.mas_equalTo(8);
|
make.width.height.mas_equalTo(14);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,20 +76,34 @@
|
|||||||
return _nameLabel;
|
return _nameLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIImageView *)imageView {
|
- (NetImageView *)imageView {
|
||||||
if (!_imageView) {
|
if (!_imageView) {
|
||||||
_imageView = [[UIImageView alloc] init];
|
NetImageConfig *config = [[NetImageConfig alloc] init];
|
||||||
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
|
_imageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
|
_imageView.layer.cornerRadius = 44/2;
|
||||||
|
_imageView.layer.masksToBounds = YES;
|
||||||
|
_imageView.layer.borderWidth = 1;
|
||||||
|
_imageView.layer.borderColor = [UIColor whiteColor].CGColor;
|
||||||
}
|
}
|
||||||
return _imageView;
|
return _imageView;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIView *)dotView {
|
- (UIImageView *)dotView {
|
||||||
if (!_dotView) {
|
if (!_dotView) {
|
||||||
_dotView = [[UIView alloc] init];
|
_dotView = [[UIImageView alloc] init];
|
||||||
_dotView.layer.cornerRadius = 4;
|
_dotView.layer.cornerRadius = 24.0;
|
||||||
_dotView.layer.masksToBounds = YES;
|
_dotView.layer.masksToBounds = YES;
|
||||||
|
_dotView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x5BC8F8), UIColorFromRGB(0x66D9D9)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(48, 48)];
|
||||||
}
|
}
|
||||||
return _dotView;
|
return _dotView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIImageView *)genderImageView {
|
||||||
|
if (!_genderImageView) {
|
||||||
|
_genderImageView = [[UIImageView alloc] init];
|
||||||
|
}
|
||||||
|
return _genderImageView;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -26,8 +26,6 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
|
|||||||
@property (nonatomic, strong) UIView *friendContentView;
|
@property (nonatomic, strong) UIView *friendContentView;
|
||||||
///好友派对view
|
///好友派对view
|
||||||
@property (nonatomic, strong) UIImageView *partyView;
|
@property (nonatomic, strong) UIImageView *partyView;
|
||||||
///好友派对中~
|
|
||||||
@property (nonatomic, strong) UIButton *partyButton;
|
|
||||||
///好友列表
|
///好友列表
|
||||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||||
|
|
||||||
@@ -82,9 +80,8 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
|
|||||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapItem:)];
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapItem:)];
|
||||||
[itemView addGestureRecognizer:tap];
|
[itemView addGestureRecognizer:tap];
|
||||||
}
|
}
|
||||||
[self.friendContentView addSubview:self.partyView];
|
|
||||||
[self.partyView addSubview:self.partyButton];
|
|
||||||
[self.friendContentView addSubview:self.collectionView];
|
[self.friendContentView addSubview:self.collectionView];
|
||||||
|
[self.friendContentView addSubview:self.partyView];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,25 +90,23 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
|
|||||||
make.edges.mas_equalTo(0);
|
make.edges.mas_equalTo(0);
|
||||||
}];
|
}];
|
||||||
[self.partyView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.partyView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.mas_equalTo(26);
|
make.left.mas_equalTo(21);
|
||||||
make.top.mas_equalTo(12);
|
make.top.mas_equalTo(12);
|
||||||
make.size.mas_equalTo(CGSizeMake(82, 16));
|
make.size.mas_equalTo(CGSizeMake(104, 29));
|
||||||
}];
|
|
||||||
[self.partyButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.edges.mas_equalTo(0);
|
|
||||||
}];
|
}];
|
||||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.mas_equalTo(16);
|
make.left.mas_equalTo(16);
|
||||||
make.right.mas_equalTo(-16);
|
make.right.mas_equalTo(-16);
|
||||||
make.height.mas_equalTo(82);
|
make.height.mas_equalTo(90);
|
||||||
make.top.mas_equalTo(self.partyView.mas_bottom);
|
make.top.mas_equalTo(self.partyView.mas_bottom).mas_offset(-5);
|
||||||
make.bottom.mas_equalTo(0);
|
make.bottom.mas_equalTo(0);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - UICollectionViewDelegate
|
#pragma mark - UICollectionViewDelegate
|
||||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||||
return self.friendsArray.count;
|
// return self.friendsArray.count;
|
||||||
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
@@ -222,9 +217,9 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
|
|||||||
if (!_collectionView) {
|
if (!_collectionView) {
|
||||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||||
layout.minimumLineSpacing = 0;
|
layout.minimumLineSpacing = 18;
|
||||||
layout.minimumInteritemSpacing = 18;
|
// layout.minimumInteritemSpacing = 18;
|
||||||
layout.itemSize = CGSizeMake(48, 68);
|
layout.itemSize = CGSizeMake(48, 90);
|
||||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||||
[_collectionView registerClass:[XPSessionListHeadFriendCell class] forCellWithReuseIdentifier:NSStringFromClass([XPSessionListHeadFriendCell class])];
|
[_collectionView registerClass:[XPSessionListHeadFriendCell class] forCellWithReuseIdentifier:NSStringFromClass([XPSessionListHeadFriendCell class])];
|
||||||
@@ -233,6 +228,7 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
|
|||||||
_collectionView.backgroundColor = UIColorRGBAlpha(0x5FCCE4, 0.12);
|
_collectionView.backgroundColor = UIColorRGBAlpha(0x5FCCE4, 0.12);
|
||||||
_collectionView.layer.cornerRadius = 8;
|
_collectionView.layer.cornerRadius = 8;
|
||||||
_collectionView.layer.masksToBounds = YES;
|
_collectionView.layer.masksToBounds = YES;
|
||||||
|
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||||
}
|
}
|
||||||
return _collectionView;
|
return _collectionView;
|
||||||
}
|
}
|
||||||
@@ -240,25 +236,9 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
|
|||||||
- (UIImageView *)partyView {
|
- (UIImageView *)partyView {
|
||||||
if (!_partyView) {
|
if (!_partyView) {
|
||||||
_partyView = [[UIImageView alloc] init];
|
_partyView = [[UIImageView alloc] init];
|
||||||
_partyView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x70F2F2), UIColorFromRGB(0x4ECDFF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(82, 16)];
|
_partyView.image = [UIImage imageNamed:@"session_list_head_friend"];
|
||||||
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 82, 16) byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(6, 6)];
|
|
||||||
CAShapeLayer *maskLayer = [CAShapeLayer layer];
|
|
||||||
maskLayer.path = path.CGPath;
|
|
||||||
_partyView.layer.mask = maskLayer;
|
|
||||||
}
|
}
|
||||||
return _partyView;
|
return _partyView;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIButton *)partyButton {
|
|
||||||
if (!_partyButton) {
|
|
||||||
_partyButton = [[UIButton alloc] init];
|
|
||||||
[_partyButton setTitle:@"好友派对中~" forState:UIControlStateNormal];
|
|
||||||
[_partyButton setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
|
|
||||||
_partyButton.titleLabel.font = [UIFont systemFontOfSize:10];
|
|
||||||
_partyButton.titleLabel.textColor = [ThemeColor mainTextColor];
|
|
||||||
|
|
||||||
}
|
|
||||||
return _partyButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|