Commit b91f60c9 cgx

动态正文页面构建

1 个父辈 62038973
......@@ -12,6 +12,10 @@
D0031549284DAC0D00CFE94D /* RelaxBodyView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0031548284DAC0D00CFE94D /* RelaxBodyView.m */; };
D003154C284DF46F00CFE94D /* RelaxTrainCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D003154B284DF46F00CFE94D /* RelaxTrainCell.m */; };
D0071C7028707BCC0035AD8A /* ScoreRulesView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0071C6F28707BCC0035AD8A /* ScoreRulesView.m */; };
D0078C5828E13A1200054804 /* MKPPlaceholderTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C5728E13A1200054804 /* MKPPlaceholderTextView.m */; };
D0078C5B28E13D4C00054804 /* DynamicDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C5A28E13D4C00054804 /* DynamicDetailController.m */; };
D0078C5E28E13DC400054804 /* DynamicDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C5D28E13DC400054804 /* DynamicDetailView.m */; };
D0078C6228E1425500054804 /* InteractView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C6128E1425500054804 /* InteractView.m */; };
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D00A63562824C42300AFFEAA /* DSNetworkCache.m */; };
D013CD3228582C1900F920B4 /* UMAPM.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D013CD1928582C1900F920B4 /* UMAPM.framework */; };
D013CD3328582C1900F920B4 /* UMCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D013CD1C28582C1900F920B4 /* UMCommon.framework */; };
......@@ -287,6 +291,14 @@
D003154B284DF46F00CFE94D /* RelaxTrainCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RelaxTrainCell.m; sourceTree = "<group>"; };
D0071C6E28707BCB0035AD8A /* ScoreRulesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScoreRulesView.h; sourceTree = "<group>"; };
D0071C6F28707BCC0035AD8A /* ScoreRulesView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScoreRulesView.m; sourceTree = "<group>"; };
D0078C5628E13A1200054804 /* MKPPlaceholderTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MKPPlaceholderTextView.h; sourceTree = "<group>"; };
D0078C5728E13A1200054804 /* MKPPlaceholderTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MKPPlaceholderTextView.m; sourceTree = "<group>"; };
D0078C5928E13D4C00054804 /* DynamicDetailController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DynamicDetailController.h; sourceTree = "<group>"; };
D0078C5A28E13D4C00054804 /* DynamicDetailController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicDetailController.m; sourceTree = "<group>"; };
D0078C5C28E13DC400054804 /* DynamicDetailView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DynamicDetailView.h; sourceTree = "<group>"; };
D0078C5D28E13DC400054804 /* DynamicDetailView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicDetailView.m; sourceTree = "<group>"; };
D0078C6028E1425500054804 /* InteractView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InteractView.h; sourceTree = "<group>"; };
D0078C6128E1425500054804 /* InteractView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InteractView.m; sourceTree = "<group>"; };
D00A63552824C42300AFFEAA /* DSNetworkCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSNetworkCache.h; sourceTree = "<group>"; };
D00A63562824C42300AFFEAA /* DSNetworkCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSNetworkCache.m; sourceTree = "<group>"; };
D013CD1928582C1900F920B4 /* UMAPM.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UMAPM.framework; sourceTree = "<group>"; };
......@@ -1427,6 +1439,12 @@
D0A3BB9128D95A2B00F58781 /* CommunityView.m */,
D070A78928DEF2D30039C5A7 /* DynamicView.h */,
D070A78A28DEF2D30039C5A7 /* DynamicView.m */,
D0078C5628E13A1200054804 /* MKPPlaceholderTextView.h */,
D0078C5728E13A1200054804 /* MKPPlaceholderTextView.m */,
D0078C5C28E13DC400054804 /* DynamicDetailView.h */,
D0078C5D28E13DC400054804 /* DynamicDetailView.m */,
D0078C6028E1425500054804 /* InteractView.h */,
D0078C6128E1425500054804 /* InteractView.m */,
);
path = View;
sourceTree = "<group>";
......@@ -1448,6 +1466,8 @@
D070A78428DEE6760039C5A7 /* BindMobileController.storyboard */,
D070A78628DEED640039C5A7 /* DynamicController.h */,
D070A78728DEED640039C5A7 /* DynamicController.m */,
D0078C5928E13D4C00054804 /* DynamicDetailController.h */,
D0078C5A28E13D4C00054804 /* DynamicDetailController.m */,
);
path = Controller;
sourceTree = "<group>";
......@@ -2313,6 +2333,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D0078C5828E13A1200054804 /* MKPPlaceholderTextView.m in Sources */,
D037C49D284F5DE8000F3089 /* TaskPointSrollView.m in Sources */,
D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */,
D0FEE7D128854967006C2B67 /* SleepReadyDoneView.m in Sources */,
......@@ -2369,6 +2390,7 @@
D0C50B3F27FD381000DC68F0 /* UIView+Extras.m in Sources */,
D0FAC41E281B817D00D4B859 /* GKPhotoManager.m in Sources */,
D07257F6286C2F110080F458 /* SignCollectionViewCell.m in Sources */,
D0078C5E28E13DC400054804 /* DynamicDetailView.m in Sources */,
D00291892816CD4500C0573B /* DsCacheUtils.m in Sources */,
D07DAC902810546A0067A1BF /* DSImagePickerController.m in Sources */,
D070A78E28DF02DE0039C5A7 /* DynamicViewModel.m in Sources */,
......@@ -2397,6 +2419,7 @@
D0A750FC282DE21D00589B0E /* NoiseAudioCell.m in Sources */,
D0C09EE028007E5F00709D4C /* BreatheController.m in Sources */,
D0A75108282E2A8500589B0E /* NoisePlayBar.m in Sources */,
D0078C6228E1425500054804 /* InteractView.m in Sources */,
D0C50B4627FD66FB00DC68F0 /* DSConstUtil.m in Sources */,
D01DC95128701ECD0035B78B /* MyPointView.m in Sources */,
D091E66B283F120100D3279E /* MyScoreModel.m in Sources */,
......@@ -2416,6 +2439,7 @@
D07DACA52810557D0067A1BF /* RSKInternalUtility.m in Sources */,
D037B11228752A7E00236753 /* IndividualController.m in Sources */,
D037B1172875635F00236753 /* DarwArcView.swift in Sources */,
D0078C5B28E13D4C00054804 /* DynamicDetailController.m in Sources */,
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D070A78828DEED640039C5A7 /* DynamicController.m in Sources */,
......
......@@ -71,6 +71,10 @@
[self.navigationController pushViewController:[NSClassFromString(@"DynamicController") new] animated:YES];
}
- (void)didSelectItem:(NSIndexPath *)indexPath {
[self.navigationController pushViewController:[NSClassFromString(@"DynamicDetailController") new] animated:YES];
}
#pragma mark - lazy
- (CommunityView *)communityView {
if (!_communityView) {
......
......@@ -118,18 +118,20 @@ static int AlbumColumnCount = 4;
[self.dynamicView refreshImageContentView];
}
// 如果用户选择了一个gif图片,下面的handle会被执行
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingGifImage:(UIImage *)animatedImage sourceAssets:(id)asset {
self.dynamicVM.selectedPhotos = [NSMutableArray arrayWithArray:@[animatedImage]];
self.dynamicVM.selectedAssets = [NSMutableArray arrayWithArray:@[asset]];
[self.dynamicView refreshImageContentView];
}
// 决定相册显示与否
- (BOOL)isAlbumCanSelect:(NSString *)albumName result:(id)result {
return YES;
}
- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - 图片上传
- (void)uploadImgsWithPhotos:(NSArray<UIImage *> *)photos picker:(TZImagePickerController *)picker {
// 1、处理图片
......
//
// DynamicDetailController.h
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 动态详情页
@interface DynamicDetailController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
// DynamicDetailController.m
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import "DynamicDetailController.h"
#import "DynamicDetailView.h"
@interface DynamicDetailController () <DynamicDetailViewDelegate>
@property (nonatomic, strong) DynamicDetailView *detailView;
@end
@implementation DynamicDetailController
- (void)loadView {
self.view = self.detailView;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"正文";
}
#pragma mark - DynamicDetailViewDelegate
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
#pragma mark - lazy
- (DynamicDetailView *)detailView {
if (!_detailView) {
_detailView = [[DynamicDetailView alloc] initWithDelegate:self];
}
return _detailView;
}
@end
......@@ -7,6 +7,8 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol CommunityViewDelegate <NSObject>
/// 点击社区头部模块
/// @param index 模块标识
......@@ -17,9 +19,11 @@
/// 点击发布按钮
- (void)publishLogicDeal;
@end
NS_ASSUME_NONNULL_BEGIN
/// 点击动态进入动态详情
/// @param indexPath indexPath
- (void)didSelectItem:(NSIndexPath *)indexPath;
@end
/// 社区主视图
@interface CommunityView : UIView
......
......@@ -101,7 +101,9 @@
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
DSLog(@"indexPath:%ld", indexPath.section)
if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectItem:)]) {
[self.delegate didSelectItem:indexPath];
}
}
#pragma mark - lazy
......
//
// DynamicDetailView.h
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol DynamicDetailViewDelegate <NSObject>
@end
/// 动态详情自定义view
@interface DynamicDetailView : UIView
@property (nonatomic, weak) id<DynamicDetailViewDelegate> delegate;
- (instancetype)initWithDelegate:(id<DynamicDetailViewDelegate>)delegate;
@end
NS_ASSUME_NONNULL_END
//
// DynamicDetailView.m
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import "DynamicDetailView.h"
#import "InteractView.h"
@interface DynamicDetailView ()
@property (nonatomic, strong) InteractView *interactView;
@end
@implementation DynamicDetailView
- (instancetype)initWithDelegate:(id<DynamicDetailViewDelegate>)delegate {
if (self = [super init]) {
self.delegate = delegate;
self.backgroundColor = DSWhite;
[self addSubview:self.interactView];
[self.interactView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.height.equalTo(@62);
make.bottom.equalTo(self).offset(-Bottom_SafeArea_Height);
}];
}
return self;
}
#pragma mark - lazy
- (InteractView *)interactView {
if (!_interactView) {
_interactView = [InteractView new];
}
return _interactView;
}
@end
......@@ -6,10 +6,11 @@
//
#import "DynamicView.h"
#import "MKPPlaceholderTextView.h"
#import "FeedImageCollectionCell.h"
@interface DynamicView () <UITextViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate>
@property (strong, nonatomic) UITextView *textView;
@property (strong, nonatomic) MKPPlaceholderTextView *textView;
@property (strong, nonatomic) UILabel *wordLimitLab;
@property (strong, nonatomic) UICollectionView *imgCollectionView;
@property (strong, nonatomic) UIButton *publishBtn;
......@@ -143,12 +144,14 @@
#pragma mark - lazy
- (UITextView *)textView {
if (!_textView) {
_textView = [[UITextView alloc] init];
_textView = [[MKPPlaceholderTextView alloc] init];
_textView.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xf0f0f0), CornerViewDarkColor, DSWhite);
_textView.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, DarkTextColor, DSWhite);
_textView.font = SysFont(14);
_textView.delegate = self;
[_textView cornerRadius:12];
_textView.placeholder = @"请文明发言,不可涉及黄、赌、毒、国家政治相关动态!";
_textView.placeholderLabel.dk_textColorPicker = DKColorPickerWithColors(UIColor.lightGrayColor, DSWhite, DSWhite);
}
return _textView;
}
......
//
// InteractView.h
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 互动区域(点赞、评论)
@interface InteractView : UIView
@end
NS_ASSUME_NONNULL_END
//
// InteractView.m
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import "InteractView.h"
#import "MKPPlaceholderTextView.h"
@interface InteractView ()
@property (nonatomic, strong) MKPPlaceholderTextView *textView;
@property (nonatomic, strong) UIButton *likeBtn;
@property (nonatomic, strong) UIButton *remarkCountBtn;
@end
@implementation InteractView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self addSubview:self.textView];
[self addSubview:self.likeBtn];
[self addSubview:self.remarkCountBtn];
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self);
make.height.equalTo(@32);
make.left.equalTo(self).offset(15);
make.right.equalTo(self.likeBtn.mas_left).offset(15);
}];
[self.likeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.remarkCountBtn.mas_left);
make.centerY.equalTo(self);
make.size.equalTo(self.remarkCountBtn);
}];
[self.remarkCountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self).offset(-15);
make.centerY.equalTo(self);
make.size.mas_equalTo(CGSizeMake(100, 30));
}];
[self.textView.placeholderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.textView);
make.left.equalTo(self.textView).offset(15);
}];
}
return self;
}
#pragma mark - lazy
- (MKPPlaceholderTextView *)textView {
if (!_textView) {
_textView = [MKPPlaceholderTextView new];
_textView.font = SysFont(12);
[_textView cornerRadius:16.5];
_textView.placeholder = @"说点什么...";
UIEdgeInsets oldInsets = _textView.textContainerInset;
_textView.textContainerInset = UIEdgeInsetsMake(oldInsets.top, 12, oldInsets.bottom, 12);
_textView.placeholderLabel.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, DSWhite, DSWhite);
_textView.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DSWhite, DSWhite);
_textView.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, DarkColor, DSWhite);
}
return _textView;
}
- (UIButton *)likeBtn {
if (!_likeBtn) {
_likeBtn = [UIButton btnWithTitle:@"23" font:SysFont(12)];
[_likeBtn dk_setTitleColorPicker:DKColorPickerWithColors(SmallTextColor, DSWhite, DSWhite) forState:UIControlStateNormal];
[_likeBtn setImage:[UIImage imageNamed:@"community_selected"] forState:UIControlStateNormal];
_likeBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 9, 0, 0);
}
return _likeBtn;
}
- (UIButton *)remarkCountBtn {
if (!_remarkCountBtn) {
_remarkCountBtn = [UIButton btnWithTitle:@"23" font:SysFont(12)];
[_remarkCountBtn dk_setTitleColorPicker:DKColorPickerWithColors(SmallTextColor, DSWhite, DSWhite) forState:UIControlStateNormal];
[_remarkCountBtn setImage:[UIImage imageNamed:@"community_selected"] forState:UIControlStateNormal];
_remarkCountBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 9, 0, 0);
}
return _remarkCountBtn;
}
@end
//
// MKPPlaceholderTextView.h
// MKPPlaceholderTextView
//
// Created by on 16/11/30.
// Copyright © 2016年 毛凯平. All rights reserved.
//
#import <UIKit/UIKit.h>
/** 自定义UITextView */
@interface MKPPlaceholderTextView : UITextView
/** 占位文字label */
@property(nonatomic, weak) UILabel *placeholderLabel;
/** 占位文字 */
@property(nonatomic, copy) NSString *placeholder;
/** 占位文字的颜色 */
@property (nonatomic, strong) UIColor *placeholderColor;
@end
//
// MKPPlaceholderTextView.m
// MKPPlaceholderTextView
//
// Created by on 16/11/30.
// Copyright © 2016年 毛凯平. All rights reserved.
//
#import "MKPPlaceholderTextView.h"
@interface MKPPlaceholderTextView ()
@end
@implementation MKPPlaceholderTextView
- (UILabel *)placeholderLabel {
if(!_placeholderLabel) {
// 添加一个用来显示占位文字的label
UILabel *placeholderLabel = [[UILabel alloc]init];
placeholderLabel.numberOfLines = 0;
placeholderLabel.x = 4;
placeholderLabel.y = 7;
[self addSubview:placeholderLabel];
_placeholderLabel = placeholderLabel;
}
return _placeholderLabel;
}
- (instancetype)initWithFrame:(CGRect)frame {
if(self = [super initWithFrame:frame]) {
// 垂直方向上永远有弹簧效果
//self.alwaysBounceVertical = YES;
// 默认字体
self.font = [UIFont systemFontOfSize:15];
// 默认的占位文字颜色
self.placeholderColor = ColorFromHexA(0xFFFFFF, .6);
// 监听文字改变
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange) name:UITextViewTextDidChangeNotification object:nil];
}
return self;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
/**
* 监听文字改变
*/
- (void)textDidChange {
// 只要有文字,就隐藏占位文字label
self.placeholderLabel.hidden = self.hasText;
}
/**
* 更新占位文字的尺寸
*/
- (void)layoutSubviews {
[super layoutSubviews];
self.placeholderLabel.width = self.width - 2 * self.placeholderLabel.x;
[self.placeholderLabel sizeToFit];
}
#pragma mark - 重写setter
- (void)setPlaceholderColor:(UIColor *)placeholderColor {
_placeholderColor = placeholderColor;
self.placeholderLabel.textColor = placeholderColor;
}
- (void)setPlaceholder:(NSString *)placeholder {
_placeholderColor = [placeholder copy];
self.placeholderLabel.text = placeholder;
[self setNeedsLayout];
}
- (void)setFont:(UIFont *)font {
[super setFont:font];
self.placeholderLabel.font = font;
[self setNeedsLayout];
}
- (void)setText:(NSString *)text {
[super setText:text];
[self textDidChange];
}
- (void)setAttributedText:(NSAttributedString *)attributedText {
[super setAttributedText:attributedText];
[self textDidChange];
}
@end
......@@ -238,10 +238,6 @@ static int AlbumColumnCount = 4;
[self presentViewController:imagePickerVc animated:YES completion:nil];
}
- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - TZImagePickerControllerDelegate
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos {
_selectedPhotos = [NSMutableArray arrayWithArray:photos];
......@@ -269,6 +265,10 @@ static int AlbumColumnCount = 4;
return YES;
}
- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - Private
- (void)printAssetsName:(NSArray *)assets {
/// 打印图片名字
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!