Commit d245df36 cgx

搭建消息中心、官方通知、收到的赞页面

1 个父辈 6775a078
正在显示 38 个修改的文件 包含 532 行增加218 行删除
//
// BaseViewController.h
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 基类控制器
@interface BaseViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
// BaseViewController.m
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "BaseViewController.h"
@interface BaseViewController ()
@end
@implementation BaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
@end
//
// BaseTableViewCell.h
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface BaseTableViewCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
//
// BaseTableViewCell.m
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "BaseTableViewCell.h"
@implementation BaseTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = DSClearColor;
}
return self;
}
@end
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
// Created by peter on 2022/10/10. // Created by peter on 2022/10/10.
// //
#import <UIKit/UIKit.h> #import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 社区消息通知页面 /// 社区消息通知页面
@interface MessageController : UIViewController @interface MessageController : BaseViewController
@end @end
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#import "MessageController.h" #import "MessageController.h"
#import "MessageNotiView.h" #import "MessageNotiView.h"
#import "OfficialNoticeController.h"
#import "PraiseListController.h"
#import "ReplyListController.h"
@interface MessageController () <MessageNotiViewDelegate> @interface MessageController () <MessageNotiViewDelegate>
@property (nonatomic, strong) MessageNotiView *messageNotiView; @property (nonatomic, strong) MessageNotiView *messageNotiView;
...@@ -24,9 +27,20 @@ ...@@ -24,9 +27,20 @@
self.navigationItem.title = @"消息中心"; self.navigationItem.title = @"消息中心";
} }
#pragma mark - 品牌模式 #pragma mark - MessageNotiViewDelegate
- (NaviStyle)navigationBarStyle { - (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
return NaviStyleDefault; if (indexPath.section == 0) {
if (indexPath.row == 0) {
OfficialNoticeController *officialVC = [OfficialNoticeController new];
[self.navigationController pushViewController:officialVC animated:YES];
} else {
PraiseListController *praiseVC = [PraiseListController new];
[self.navigationController pushViewController:praiseVC animated:YES];
}
} else {
ReplyListController *replyList = [ReplyListController new];
[self.navigationController pushViewController:replyList animated:YES];
}
} }
#pragma mark - lazy #pragma mark - lazy
......
//
// OfficialNoticeController.h
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
/// 官方通知页面
@interface OfficialNoticeController : BaseViewController
@end
NS_ASSUME_NONNULL_END
//
// OfficialNoticeController.m
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "OfficialNoticeController.h"
@interface OfficialNoticeController ()
@end
@implementation OfficialNoticeController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"官方通知";
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
}
@end
//
// PraiseListController.h
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 点赞列表
@interface PraiseListController : UITableViewController
@end
NS_ASSUME_NONNULL_END
//
// PraiseListController.m
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "PraiseListController.h"
#import "PraiseCell.h"
@interface PraiseListController ()
@property (nonatomic, strong) DSDataSource *dataSource;
@end
@implementation PraiseListController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"收到的赞";
NSMutableArray *tmpArr = [NSMutableArray array];
for (int i = 0; i < 10; i++) {
PraiseModel *model = [PraiseModel new];
model.user_profile = @"https://img2.ydniu.com/sleep_ssmain/face_img/1657350090882_1BORX6.jpg";
model.nick_name = @"叽叽歪歪";
model.publish_time = @"2022-09-11";
model.content = @"好高好高好高好高好高好高好";
[tmpArr addObject:model];
}
[self.dataSource addDataArray:tmpArr.copy];
self.tableView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.tableView.showsVerticalScrollIndicator = NO;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerClass:[PraiseCell class] forCellReuseIdentifier:NSStringFromClass([PraiseCell class])];
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 97;
}
#pragma mark - lazy
- (DSDataSource *)dataSource {
if (!_dataSource) {
CellConfigureBlock cellBlock = ^(PraiseCell * cell, PraiseModel * model, NSIndexPath * indexPath) {
cell.praiseModel = model;
};
_dataSource = [[DSDataSource alloc] initWithIdentifier:NSStringFromClass([PraiseCell class]) datas:@[] isSection:NO configureBlock:cellBlock];
self.tableView.dataSource = _dataSource;
}
return _dataSource;
}
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>error</key>
<string>&quot;&quot;</string>
<key>result</key>
<array>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>张三</string>
<key>time</key>
<string>1分钟前</string>
<key>content</key>
<string>国庆放假要好好计划下,健身打卡</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653288028602_1yFqHL.jpg</string>
</array>
<key>isLike</key>
<false/>
<key>likeCount</key>
<integer>2</integer>
<key>remarkCount</key>
<integer>0</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>李四</string>
<key>time</key>
<string>半个小时前</string>
<key>content</key>
<string>长沙好好玩,各种美食应有尽有,吃喝玩乐嗨起来,周末约朋友喝茶颜去。。。</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653288005388_7wuK9n.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653277874846_BzEuFF.jpg</string>
</array>
<key>isLike</key>
<true/>
<key>likeCount</key>
<integer>33</integer>
<key>remarkCount</key>
<integer>2</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>李四</string>
<key>time</key>
<string>半个小时前</string>
<key>content</key>
<string>长沙好好玩,各种美食应有尽有,吃喝玩乐嗨起来,周末约朋友喝茶颜去。。。</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653288005388_7wuK9n.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653277874846_BzEuFF.jpg</string>
</array>
<key>isLike</key>
<true/>
<key>likeCount</key>
<integer>33</integer>
<key>remarkCount</key>
<integer>2</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>王五</string>
<key>time</key>
<string>昨天</string>
<key>content</key>
<string>国庆放假要好好计划下,健身打卡</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653302478340_liIqbO.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653301114665_lwDNUG.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653301150570_zfQ0jW.jpg</string>
</array>
<key>isLike</key>
<false/>
<key>likeCount</key>
<integer>0</integer>
<key>remarkCount</key>
<integer>0</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>王五</string>
<key>time</key>
<string>昨天</string>
<key>content</key>
<string>国庆放假要好好计划下,健身打卡</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653302478340_liIqbO.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653301114665_lwDNUG.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653301150570_zfQ0jW.jpg</string>
</array>
<key>isLike</key>
<false/>
<key>likeCount</key>
<integer>0</integer>
<key>remarkCount</key>
<integer>0</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>王五</string>
<key>time</key>
<string>昨天</string>
<key>content</key>
<string>国庆放假要好好计划下,健身打卡</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653302478340_liIqbO.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653301114665_lwDNUG.jpg</string>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653301150570_zfQ0jW.jpg</string>
</array>
<key>isLike</key>
<false/>
<key>likeCount</key>
<integer>0</integer>
<key>remarkCount</key>
<integer>0</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>异次元</string>
<key>time</key>
<string>3天前</string>
<key>content</key>
<string>觉知当下,与家人建立和谐关系觉知当下,与家人建立和谐关系觉知当下,与家人建立和谐关系觉知当下,与家人建立和谐关系觉知当下,与家人建立和谐关系觉知当下,与家人建立和谐关系觉知当下,与家人建立和谐关系&quot;觉知当下,与家人建立和谐关系&quot;觉知当下,与家人建立和谐关系觉知当下,与家人建立和谐关系&quot;觉知当下,与家人建立和谐关系&quot;觉知当下,与家人建立和谐关系&quot;觉知当下,与家人建立和谐关系&quot;觉知当下,与家人建立和谐关系&quot;</string>
<key>isLike</key>
<false/>
<key>likeCount</key>
<integer>2</integer>
<key>remarkCount</key>
<integer>0</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>张三</string>
<key>time</key>
<string>1分钟前</string>
<key>content</key>
<string>国庆放假要好好计划下,健身打卡</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653288028602_1yFqHL.jpg</string>
</array>
<key>isLike</key>
<false/>
<key>likeCount</key>
<integer>2</integer>
<key>remarkCount</key>
<integer>0</integer>
</dict>
<dict>
<key>userIcon</key>
<string>https://img2.ydniu.com/sleep_ssmain/face_img/1658215539163_ZsA0sm.jpg</string>
<key>userName</key>
<string>张三</string>
<key>time</key>
<string>1分钟前</string>
<key>content</key>
<string>国庆放假要好好计划下,健身打卡</string>
<key>imgUrls</key>
<array>
<string>https://img2.ydniu.com/sleep_ssmain/relax/1653288028602_1yFqHL.jpg</string>
</array>
<key>isLike</key>
<false/>
<key>likeCount</key>
<integer>2</integer>
<key>remarkCount</key>
<integer>0</integer>
</dict>
</array>
<key>res_code</key>
<integer>1</integer>
</dict>
</plist>
...@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXTERN UIFont * const CommentContentFont; FOUNDATION_EXTERN UIFont * const CommentContentFont;
/// 评论回复model /// 动态评论回复model
@interface ComReplyModel : NSObject @interface ComReplyModel : NSObject
/// 评论model /// 评论model
@property (nonatomic, strong) CommentModel *commentModel; @property (nonatomic, strong) CommentModel *commentModel;
......
//
// MessageNotiModel.h
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 消息中心官方通知和收到点赞数据model
@interface MessageNotiModel : NSObject
@property (nonatomic, copy) NSString *iconName;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *detail;
@property (nonatomic, assign) int messageCount;
@end
NS_ASSUME_NONNULL_END
//
// MessageNotiModel.m
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "MessageNotiModel.h"
@implementation MessageNotiModel
@end
//
// PraiseModel.h
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface PraiseModel : NSObject
/// 头像
@property (nonatomic, copy) NSString *user_profile;
/// 昵称
@property (nonatomic, copy) NSString *nick_name;
/// 回复时间
@property (nonatomic, copy) NSString *publish_time;
/// 内容
@property (nonatomic, copy) NSString *content;
@end
NS_ASSUME_NONNULL_END
//
// PraiseModel.m
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "PraiseModel.h"
@implementation PraiseModel
@end
...@@ -9,15 +9,12 @@ ...@@ -9,15 +9,12 @@
@implementation CommentReplyCell @implementation CommentReplyCell
- (void)awakeFromNib { - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
[super awakeFromNib]; if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
// Initialization code self.selectionStyle = UITableViewCellSelectionStyleNone;
} self.backgroundColor = DSClearColor;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { return self;
[super setSelected:selected animated:animated];
// Configure the view for the selected state
} }
@end @end
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "MessageNotiModel.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 消息中心顶部官方通知和点赞通知cell /// 消息中心顶部官方通知和点赞通知cell
@interface MessageNotiCell : UITableViewCell @interface MessageNotiCell : UITableViewCell
@property (nonatomic, strong) MessageNotiModel *messageNotiModel;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
@property (nonatomic, strong) UIImageView *icon; @property (nonatomic, strong) UIImageView *icon;
@property (nonatomic, strong) UILabel *titleLab; @property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UILabel *detailLab; @property (nonatomic, strong) UILabel *detailLab;
@property (nonatomic, strong) UILabel *mesCountLab;
@end @end
@implementation MessageNotiCell @implementation MessageNotiCell
...@@ -23,23 +24,76 @@ ...@@ -23,23 +24,76 @@
[self.contentView addSubview:self.icon]; [self.contentView addSubview:self.icon];
[self.contentView addSubview:self.titleLab]; [self.contentView addSubview:self.titleLab];
[self.contentView addSubview:self.detailLab]; [self.contentView addSubview:self.detailLab];
[self.contentView addSubview:self.mesCountLab];
[self.icon mas_makeConstraints:^(MASConstraintMaker *make) { [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(30); make.left.equalTo(self.contentView).offset(15);
make.top.equalTo(self.contentView); make.top.equalTo(self.contentView).offset(18);
make.size.mas_equalTo(CGSizeMake(40, 40)); make.size.mas_equalTo(CGSizeMake(40, 40));
}]; }];
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.icon.mas_right).offset(14); make.left.equalTo(self.icon.mas_right).offset(12);
make.top.equalTo(self.icon); make.top.equalTo(self.icon);
make.right.equalTo(self.contentView).offset(-30); make.right.equalTo(self.contentView).offset(-50);
}]; }];
[self.detailLab mas_makeConstraints:^(MASConstraintMaker *make) { [self.detailLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLab); make.left.equalTo(self.titleLab);
make.bottom.equalTo(self.icon); make.bottom.equalTo(self.icon);
make.right.equalTo(self.titleLab);
}];
[self.mesCountLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.contentView).offset(-15);
make.size.mas_equalTo(CGSizeMake(20, 20));
}]; }];
} }
return self; return self;
} }
- (void)setMessageNotiModel:(MessageNotiModel *)messageNotiModel {
_messageNotiModel = messageNotiModel;
self.icon.image = [UIImage imageNamed:messageNotiModel.iconName];
self.titleLab.text = messageNotiModel.title;
self.detailLab.text = messageNotiModel.detail;
self.mesCountLab.hidden = !messageNotiModel.messageCount;
self.mesCountLab.text = [NSString stringWithFormat:@"%d", messageNotiModel.messageCount];
}
#pragma mark - lazy
- (UIImageView *)icon {
if (!_icon) {
_icon = [UIImageView new];
_icon.dk_alphaPicker = DKAlphaPickerWithAlphas(1, .5, .5);
[_icon cornerRadius:20];
}
return _icon;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel labWithFont:BoldFont(15)];
_titleLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
}
return _titleLab;
}
- (UILabel *)detailLab {
if (!_detailLab) {
_detailLab = [UILabel labWithFont:SysFont(14)];
_detailLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHexA(0xFFFFFF, .5), DSWhite);
}
return _detailLab;
}
- (UILabel *)mesCountLab {
if (!_mesCountLab) {
_mesCountLab = [UILabel labWithTextColor:DSWhite font:SysFont(12)];
_mesCountLab.backgroundColor = ColorFromHex(0xF04B77);
_mesCountLab.textAlignment = NSTextAlignmentCenter;
[_mesCountLab cornerRadius:10];
}
return _mesCountLab;
}
@end @end
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol MessageNotiViewDelegate <NSObject> @protocol MessageNotiViewDelegate <NSObject>
- (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
@end @end
/// 消息通知view /// 消息通知view
......
...@@ -104,4 +104,10 @@ static int secFooterHeight = 8; ...@@ -104,4 +104,10 @@ static int secFooterHeight = 8;
} }
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.messageDelegate && [self.messageDelegate respondsToSelector:@selector(didSelectRowAtIndexPath:)]) {
[self.messageDelegate didSelectRowAtIndexPath:indexPath];
}
}
@end @end
//
// PraiseCell.h
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "BaseTableViewCell.h"
#import "PraiseModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 点赞cell
@interface PraiseCell : BaseTableViewCell
@property (nonatomic, strong) PraiseModel *praiseModel;
@end
NS_ASSUME_NONNULL_END
//
// PraiseCell.m
// DreamSleep
//
// Created by peter on 2022/10/11.
//
#import "PraiseCell.h"
@interface PraiseCell ()
@property (nonatomic, strong) UIImageView *userIcon;
@property (nonatomic, strong) UILabel *userNameLab;
@property (nonatomic, strong) UILabel *timeLab;
@property (nonatomic, strong) UILabel *tipLab;
@property (nonatomic, strong) UILabel *contentLab;
@end
@implementation PraiseCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self.contentView addSubview:self.userIcon];
[self.contentView addSubview:self.userNameLab];
[self.contentView addSubview:self.timeLab];
[self.contentView addSubview:self.tipLab];
[self.contentView addSubview:self.contentLab];
[self.userIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(15);
make.top.equalTo(self.contentView).offset(15);
make.size.mas_equalTo(CGSizeMake(40, 40));
}];
[self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView).offset(18);
make.right.equalTo(self.contentView).offset(-15);
}];
[self.tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.userNameLab);
make.bottom.equalTo(self.userIcon);
}];
[self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.userIcon.mas_bottom).offset(7);
make.left.equalTo(self.contentView).offset(73);
}];
}
return self;
}
- (void)setPraiseModel:(PraiseModel *)praiseModel {
_praiseModel = praiseModel;
[self.userIcon yy_setImageWithURL:[NSURL URLWithString:praiseModel.user_profile] placeholder:[UIImage defaultPlaceholderWithSize:CGSizeMake(40, 40)]];
self.userNameLab.text = praiseModel.nick_name;
self.timeLab.text = praiseModel.publish_time;
[self.timeLab sizeToFit];
self.contentLab.text = praiseModel.content;
[self.userNameLab mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.userIcon.mas_right).offset(12);
make.top.equalTo(self.userIcon);
make.right.equalTo(self.timeLab.mas_left).offset(-30);
}];
}
#pragma mark - lazy
- (UIImageView *)userIcon {
if (!_userIcon) {
_userIcon = [UIImageView new];
[_userIcon cornerRadius:20];
_userIcon.dk_alphaPicker = DKAlphaPickerWithAlphas(1.f, 0.5f, 0.1f);
}
return _userIcon;
}
- (UILabel *)userNameLab {
if (!_userNameLab) {
_userNameLab = [UILabel labWithFont:BoldFont(15)];
_userNameLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
}
return _userNameLab;
}
- (UILabel *)timeLab {
if (!_timeLab) {
_timeLab = [UILabel labWithFont:SysFont(12)];
_timeLab.textAlignment = NSTextAlignmentRight;
_timeLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _timeLab;
}
- (UILabel *)tipLab {
if (!_tipLab) {
_tipLab = [UILabel labWithFont:SysFont(12)];
_tipLab.text = @"赞了你的动态";
_tipLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .3), DSWhite);
}
return _tipLab;
}
- (UILabel *)contentLab {
if (!_contentLab) {
_contentLab = [UILabel labWithFont:SysFont(14)];
_contentLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHexA(0xFFFFFF, .4), DSWhite);
}
return _contentLab;
}
@end
{
"images" : [
{
"filename" : "ic_xiaoxi_guanfangtongzhi.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_xiaoxi_guanfangtongzhi@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_xiaoxi_guanfangtongzhi@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_xiaoxi_shoudaodezan.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_xiaoxi_shoudaodezan@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_xiaoxi_shoudaodezan@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!