chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// TLUserDetailAlbumCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/29.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailBaseKVCell.h"
|
||||
|
||||
@interface TLUserDetailAlbumCell : TLUserDetailBaseKVCell
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// TLUserDetailAlbumCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/29.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailAlbumCell.h"
|
||||
|
||||
#define HEIGHT_ALBUM_ITEM 60
|
||||
#define SPACE_ALBUM_ITEM 8
|
||||
|
||||
@interface TLUserDetailAlbumCell ()
|
||||
|
||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||
@property (nonatomic, strong) ZZFLEXAngel *angel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailAlbumCell
|
||||
|
||||
+ (CGFloat)viewHeightByDataModel:(id)dataModel
|
||||
{
|
||||
return 90.0f;
|
||||
}
|
||||
|
||||
- (void)setViewDataModel:(TLUserDetailKVModel *)dataModel
|
||||
{
|
||||
[super setViewDataModel:dataModel];
|
||||
NSArray *data = dataModel.data;
|
||||
|
||||
NSInteger maxCount = (SCREEN_WIDTH - 118) / (HEIGHT_ALBUM_ITEM + SPACE_ALBUM_ITEM);
|
||||
|
||||
data = data.count > maxCount ? [data subarrayWithRange:NSMakeRange(0, maxCount)] : data;
|
||||
|
||||
self.angel.clear();
|
||||
self.angel.addSection(0).minimumInteritemSpacing(SPACE_ALBUM_ITEM).minimumLineSpacing(SPACE_ALBUM_ITEM);
|
||||
self.angel.addCells(@"TLUserDetailAlbumItemCell").toSection(0).withDataModelArray(data);
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.collectionView = self.detailContentView.addCollectionView(1)
|
||||
.backgroundColor([UIColor clearColor])
|
||||
.userInteractionEnabled(NO)
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(0);
|
||||
make.right.mas_equalTo(-15);
|
||||
make.height.mas_equalTo(HEIGHT_ALBUM_ITEM);
|
||||
make.centerY.mas_equalTo(0);
|
||||
})
|
||||
.view;
|
||||
|
||||
[(UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
|
||||
|
||||
self.angel = [[ZZFLEXAngel alloc] initWithHostView:self.collectionView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface TLUserDetailAlbumItemCell :UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
|
||||
|
||||
@property (nonatomic, strong) UIImageView *imageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailAlbumItemCell
|
||||
|
||||
+ (CGSize)viewSizeByDataModel:(id)dataModel
|
||||
{
|
||||
return CGSizeMake(HEIGHT_ALBUM_ITEM, HEIGHT_ALBUM_ITEM);
|
||||
}
|
||||
|
||||
- (void)setViewDataModel:(id)dataModel
|
||||
{
|
||||
if (dataModel) {
|
||||
[self.imageView tt_setImageWithURL:TLURL(dataModel) placeholderImage:[UIImage imageWithColor:[UIColor colorGrayBG]]];
|
||||
}
|
||||
else {
|
||||
[self.imageView setImage:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.imageView = self.contentView.addImageView(1)
|
||||
.contentMode(UIViewContentModeScaleAspectFill).clipsToBounds(YES)
|
||||
.masonry(^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(0);
|
||||
})
|
||||
.view;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// TLUserDetailBaseInfoCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/29.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TLUser.h"
|
||||
|
||||
@interface TLUserDetailBaseInfoCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
|
||||
|
||||
@property (nonatomic, strong) TLUser *userModel;
|
||||
|
||||
@end
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// TLUserDetailBaseInfoCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/29.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailBaseInfoCell.h"
|
||||
#import "TLUser.h"
|
||||
#import "TLMacros.h"
|
||||
|
||||
#define MINE_SPACE_X 14.0f
|
||||
#define MINE_SPACE_Y 12.0f
|
||||
|
||||
@interface TLUserDetailBaseInfoCell ()
|
||||
|
||||
@property (nonatomic, strong) UIButton *avatarView;
|
||||
@property (nonatomic, strong) UILabel *shownameLabel;
|
||||
@property (nonatomic, strong) UILabel *usernameLabel;
|
||||
@property (nonatomic, strong) UILabel *nikenameLabel;
|
||||
|
||||
@property (nonatomic, copy) id (^eventAction)(NSInteger, id);
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailBaseInfoCell
|
||||
|
||||
+ (CGFloat)viewHeightByDataModel:(id)dataModel
|
||||
{
|
||||
return 90.0f;
|
||||
}
|
||||
|
||||
- (void)setViewDataModel:(id)dataModel
|
||||
{
|
||||
[self setUserModel:dataModel];
|
||||
}
|
||||
|
||||
- (void)setViewEventAction:(id (^)(NSInteger, id))eventAction
|
||||
{
|
||||
self.eventAction = eventAction;
|
||||
}
|
||||
|
||||
- (void)viewIndexPath:(NSIndexPath *)indexPath sectionItemCount:(NSInteger)count
|
||||
{
|
||||
if (indexPath.row == 0) {
|
||||
self.addSeparator(ZZSeparatorPositionTop);
|
||||
}
|
||||
|
||||
if (indexPath.row == count - 1) {
|
||||
self.addSeparator(ZZSeparatorPositionBottom);
|
||||
}
|
||||
else {
|
||||
self.addSeparator(ZZSeparatorPositionBottom).beginAt(15);
|
||||
}
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self setBackgroundColor:[UIColor whiteColor]];
|
||||
|
||||
[self p_initUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setUserModel:(TLUser *)userModel
|
||||
{
|
||||
_userModel = userModel;
|
||||
if (userModel.avatarPath) {
|
||||
[self.avatarView setImage:[UIImage imageNamed:userModel.avatarPath] forState:UIControlStateNormal];
|
||||
}
|
||||
else{
|
||||
[self.avatarView tt_setImageWithURL:TLURL(userModel.avatarURL) forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:DEFAULT_AVATAR_PATH]];
|
||||
}
|
||||
[self.shownameLabel setText:userModel.showName];
|
||||
if (userModel.username.length > 0) {
|
||||
[self.usernameLabel setText:[NSString stringWithFormat:@"%@:%@", LOCSTR(@"微信号"), userModel.username]];
|
||||
if (userModel.nikeName.length > 0) {
|
||||
[self.nikenameLabel setText:[NSString stringWithFormat:@"%@:%@", LOCSTR(@"昵称"), userModel.nikeName]];
|
||||
}
|
||||
}
|
||||
else if (userModel.nikeName.length > 0){
|
||||
[self.nikenameLabel setText:[NSString stringWithFormat:@"%@:%@", LOCSTR(@"昵称"), userModel.nikeName]];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - # UI
|
||||
- (void)p_initUI
|
||||
{
|
||||
@weakify(self);
|
||||
|
||||
// 头像
|
||||
self.avatarView = self.contentView.addButton(1)
|
||||
.cornerRadius(5)
|
||||
.eventBlock(UIControlEventTouchUpInside, ^(UIButton *sender) {
|
||||
@strongify(self);
|
||||
if (self.eventAction) {
|
||||
self.eventAction(0, self.userModel);
|
||||
}
|
||||
})
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(14);
|
||||
make.top.mas_equalTo(12);
|
||||
make.bottom.mas_equalTo(-12);
|
||||
})
|
||||
.view;
|
||||
|
||||
[self.avatarView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.avatarView.mas_height);
|
||||
}];
|
||||
|
||||
// 用户昵称
|
||||
self.shownameLabel = self.contentView.addLabel(2)
|
||||
.font([UIFont systemFontOfSize:17.0f])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.avatarView.mas_right).mas_offset(MINE_SPACE_Y);
|
||||
make.top.mas_equalTo(self.avatarView.mas_top).mas_offset(3);
|
||||
})
|
||||
.view;
|
||||
[self.shownameLabel setContentCompressionResistancePriority:100 forAxis:UILayoutConstraintAxisHorizontal];
|
||||
|
||||
// 用户名
|
||||
self.usernameLabel = self.contentView.addLabel(3)
|
||||
.font([UIFont systemFontOfSize:14.0f])
|
||||
.textColor([UIColor grayColor])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.shownameLabel);
|
||||
make.top.mas_equalTo(self.shownameLabel.mas_bottom).mas_offset(5);
|
||||
})
|
||||
.view;
|
||||
|
||||
// 昵称
|
||||
self.nikenameLabel = self.contentView.addLabel(4)
|
||||
.textColor([UIColor grayColor])
|
||||
.font([UIFont systemFontOfSize:14.0f])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.shownameLabel);
|
||||
make.top.mas_equalTo(self.usernameLabel.mas_bottom).mas_offset(3);
|
||||
})
|
||||
.view;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// TLUserDetailBaseKVCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class TLUserDetailKVModel;
|
||||
TLUserDetailKVModel *createUserDetailKVModel(NSString *title, id data);
|
||||
|
||||
@interface TLUserDetailKVModel : NSObject
|
||||
|
||||
@property (nonatomic, strong) NSString *title;
|
||||
|
||||
@property (nonatomic, strong) id data;
|
||||
|
||||
@property (nonatomic, assign) BOOL hiddenArrow;
|
||||
|
||||
@property (nonatomic, assign) BOOL selectable;
|
||||
|
||||
@end
|
||||
|
||||
@interface TLUserDetailBaseKVCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
|
||||
@property (nonatomic, strong) UIView *detailContentView;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// TLUserDetailBaseKVCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailBaseKVCell.h"
|
||||
|
||||
TLUserDetailKVModel *createUserDetailKVModel(NSString *title, id data)
|
||||
{
|
||||
TLUserDetailKVModel *model = [[TLUserDetailKVModel alloc] init];
|
||||
model.title = title;
|
||||
model.data = data;
|
||||
return model;
|
||||
}
|
||||
|
||||
@interface TLUserDetailBaseKVCell ()
|
||||
|
||||
@property (nonatomic, strong) UIView *arrowView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailBaseKVCell
|
||||
|
||||
+ (CGFloat)viewHeightByDataModel:(id)dataModel
|
||||
{
|
||||
return 44.0f;
|
||||
}
|
||||
|
||||
- (void)setViewDataModel:(TLUserDetailKVModel *)dataModel
|
||||
{
|
||||
[self.titleLabel setText:dataModel.title];
|
||||
[self.arrowView setHidden:dataModel.hiddenArrow];
|
||||
[self setSelectedBackgrounColor:dataModel.selectable ? [UIColor colorGrayLine] : nil];
|
||||
}
|
||||
|
||||
- (void)viewIndexPath:(NSIndexPath *)indexPath sectionItemCount:(NSInteger)count
|
||||
{
|
||||
if (indexPath.row == 0) {
|
||||
self.addSeparator(ZZSeparatorPositionTop);
|
||||
}
|
||||
|
||||
if (indexPath.row == count - 1) {
|
||||
self.addSeparator(ZZSeparatorPositionBottom);
|
||||
}
|
||||
else {
|
||||
self.addSeparator(ZZSeparatorPositionBottom).beginAt(15);
|
||||
}
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self setBackgroundColor:[UIColor whiteColor]];
|
||||
|
||||
self.titleLabel = self.contentView.addLabel(1)
|
||||
.font([UIFont systemFontOfSize:16])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(15);
|
||||
make.centerY.mas_equalTo(0);
|
||||
make.width.mas_equalTo(80);
|
||||
})
|
||||
.view;
|
||||
|
||||
self.arrowView = self.contentView.addImageView(2)
|
||||
.image([UIImage imageNamed:@"right_arrow"])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(0);
|
||||
make.size.mas_equalTo(CGSizeMake(8, 13));
|
||||
make.right.mas_equalTo(-15);
|
||||
})
|
||||
.view;
|
||||
|
||||
self.detailContentView = self.contentView.addView(3)
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.titleLabel.mas_right);
|
||||
make.right.mas_equalTo(self.arrowView.mas_left);
|
||||
make.top.bottom.mas_equalTo(0);
|
||||
})
|
||||
.view;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailKVModel
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self.selectable = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// TLUserDetailButtonCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface TLUserDetailChatButtonCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
|
||||
|
||||
@property (nonatomic, strong) UIButton *button;
|
||||
|
||||
@end
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// TLUserDetailButtonCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailChatButtonCell.h"
|
||||
|
||||
@interface TLUserDetailChatButtonCell ()
|
||||
|
||||
@property (nonatomic, copy) id (^eventAction)(NSInteger, id);
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailChatButtonCell
|
||||
|
||||
+ (CGFloat)viewHeightByDataModel:(id)dataModel
|
||||
{
|
||||
return 62.0f;
|
||||
}
|
||||
|
||||
- (void)setViewDataModel:(id)dataModel
|
||||
{
|
||||
[self.button setTitle:dataModel forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
- (void)setViewEventAction:(id (^)(NSInteger, id))eventAction
|
||||
{
|
||||
self.eventAction = eventAction;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
@weakify(self);
|
||||
self.button = self.contentView.addButton(1)
|
||||
.backgroundColor([UIColor colorGreenDefault]).titleColor([UIColor whiteColor]).titleFont([UIFont systemFontOfSize:18])
|
||||
.backgroundColorHL([UIColor colorGreenHL]).titleColorHL([[UIColor whiteColor] colorWithAlphaComponent:0.7])
|
||||
.cornerRadius(5).borderWidth(1).borderColor([UIColor colorGrayLine].CGColor)
|
||||
.masonry(^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(15);
|
||||
make.right.mas_equalTo(-15);
|
||||
make.top.mas_equalTo(0);
|
||||
make.bottom.mas_equalTo(-15);
|
||||
})
|
||||
.eventBlock(UIControlEventTouchUpInside, ^(UIButton *sender) {
|
||||
@strongify(self);
|
||||
if (self.eventAction) {
|
||||
self.eventAction(0, nil);
|
||||
}
|
||||
})
|
||||
.view;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLUserDetailNormalKVCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailBaseKVCell.h"
|
||||
|
||||
@interface TLUserDetailNormalKVCell : TLUserDetailBaseKVCell
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// TLUserDetailNormalKVCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailNormalKVCell.h"
|
||||
|
||||
@interface TLUserDetailNormalKVCell ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *detailLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailNormalKVCell
|
||||
|
||||
- (void)setViewDataModel:(TLUserDetailKVModel *)dataModel
|
||||
{
|
||||
[super setViewDataModel:dataModel];
|
||||
|
||||
[self.detailLabel setText:dataModel.data];
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.detailLabel = self.detailContentView.addLabel(1001)
|
||||
.font([UIFont systemFontOfSize:16])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(0);
|
||||
})
|
||||
.view;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLUserDetailPhoneKVCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailBaseKVCell.h"
|
||||
|
||||
@interface TLUserDetailPhoneKVCell : TLUserDetailBaseKVCell
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// TLUserDetailPhoneKVCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailPhoneKVCell.h"
|
||||
|
||||
@interface TLUserDetailPhoneKVCell ()
|
||||
|
||||
@property (nonatomic, strong) UIButton *phoneButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailPhoneKVCell
|
||||
|
||||
- (void)setViewDataModel:(TLUserDetailKVModel *)dataModel
|
||||
{
|
||||
[super setViewDataModel:dataModel];
|
||||
|
||||
[self.phoneButton setTitle:dataModel.data forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.phoneButton = self.detailContentView.addButton(1)
|
||||
.titleColor([UIColor colorBlueMoment]).titleFont([UIFont systemFontOfSize:16])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.top.bottom.mas_equalTo(0);
|
||||
})
|
||||
.eventBlock(UIControlEventTouchUpInside, ^(UIButton *sender) {
|
||||
NSString *phone = sender.currentTitle;
|
||||
NSString *urlString = [NSString stringWithFormat:@"tel:%@", phone];
|
||||
[[UIApplication sharedApplication] openURL:TLURL(urlString)];
|
||||
})
|
||||
.view;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLUserDetailTagsKVCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailBaseKVCell.h"
|
||||
|
||||
@interface TLUserDetailTagsKVCell : TLUserDetailBaseKVCell
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// TLUserDetailTagsKVCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailTagsKVCell.h"
|
||||
|
||||
@interface TLUserDetailTagsKVCell ()
|
||||
|
||||
@property (nonatomic, strong) UIButton *phoneButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailTagsKVCell
|
||||
|
||||
- (void)setViewDataModel:(TLUserDetailKVModel *)dataModel
|
||||
{
|
||||
[super setViewDataModel:dataModel];
|
||||
|
||||
[self.phoneButton setTitle:dataModel.data forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.phoneButton = self.detailContentView.addButton(1)
|
||||
.titleColor([UIColor colorGreenDefault]).titleFont([UIFont systemFontOfSize:16])
|
||||
.userInteractionEnabled(NO)
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.top.bottom.mas_equalTo(0);
|
||||
})
|
||||
.eventBlock(UIControlEventTouchUpInside, ^(UIButton *sender) {
|
||||
NSString *phone = sender.currentTitle;
|
||||
NSString *urlString = [NSString stringWithFormat:@"tel:%@", phone];
|
||||
[[UIApplication sharedApplication] openURL:TLURL(urlString)];
|
||||
})
|
||||
.view;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLUserDetailTitleCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface TLUserDetailTitleCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// TLUserDetailTitleCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailTitleCell.h"
|
||||
|
||||
@interface TLUserDetailTitleCell ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLUserDetailTitleCell
|
||||
|
||||
+ (CGFloat)viewHeightByDataModel:(id)dataModel
|
||||
{
|
||||
return 44.0f;
|
||||
}
|
||||
|
||||
- (void)setViewDataModel:(id)dataModel
|
||||
{
|
||||
[self.titleLabel setText:dataModel];
|
||||
}
|
||||
|
||||
- (void)viewIndexPath:(NSIndexPath *)indexPath sectionItemCount:(NSInteger)count
|
||||
{
|
||||
if (indexPath.row == 0) {
|
||||
self.addSeparator(ZZSeparatorPositionTop);
|
||||
}
|
||||
|
||||
if (indexPath.row == count - 1) {
|
||||
self.addSeparator(ZZSeparatorPositionBottom);
|
||||
}
|
||||
else {
|
||||
self.addSeparator(ZZSeparatorPositionBottom).beginAt(15);
|
||||
}
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self setBackgroundColor:[UIColor whiteColor]];
|
||||
[self setSelectedBackgrounColor:[UIColor colorGrayLine]];
|
||||
|
||||
UIImageView *arrowView = self.contentView.addImageView(2)
|
||||
.image([UIImage imageNamed:@"right_arrow"])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(0);
|
||||
make.size.mas_equalTo(CGSizeMake(8, 13));
|
||||
make.right.mas_equalTo(-15);
|
||||
})
|
||||
.view;
|
||||
|
||||
self.titleLabel = self.contentView.addLabel(1)
|
||||
.font([UIFont systemFontOfSize:16])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(15);
|
||||
make.centerY.mas_equalTo(0);
|
||||
make.right.mas_lessThanOrEqualTo(arrowView.mas_left).mas_offset(-15);
|
||||
})
|
||||
.view;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLUserDetailViewChatButtonCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailChatButtonCell.h"
|
||||
|
||||
@interface TLUserDetailViewChatButtonCell : TLUserDetailChatButtonCell
|
||||
|
||||
@end
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// TLUserDetailViewChatButtonCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/7.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLUserDetailViewChatButtonCell.h"
|
||||
|
||||
@implementation TLUserDetailViewChatButtonCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.button.zz_make.backgroundColor([UIColor whiteColor]).titleColor([UIColor blackColor])
|
||||
.backgroundColorHL([UIColor lightGrayColor]).titleColorHL([[UIColor blackColor] colorWithAlphaComponent:0.7]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user