Commit 7bd980b7 cgx

完成回复弹框

1 个父辈 b91f60c9
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
D0078C5B28E13D4C00054804 /* DynamicDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C5A28E13D4C00054804 /* DynamicDetailController.m */; }; D0078C5B28E13D4C00054804 /* DynamicDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C5A28E13D4C00054804 /* DynamicDetailController.m */; };
D0078C5E28E13DC400054804 /* DynamicDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C5D28E13DC400054804 /* DynamicDetailView.m */; }; D0078C5E28E13DC400054804 /* DynamicDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C5D28E13DC400054804 /* DynamicDetailView.m */; };
D0078C6228E1425500054804 /* InteractView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C6128E1425500054804 /* InteractView.m */; }; D0078C6228E1425500054804 /* InteractView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C6128E1425500054804 /* InteractView.m */; };
D0078C6F28E19C9F00054804 /* TextInputAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0078C6E28E19C9F00054804 /* TextInputAlertView.m */; };
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D00A63562824C42300AFFEAA /* DSNetworkCache.m */; }; D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D00A63562824C42300AFFEAA /* DSNetworkCache.m */; };
D013CD3228582C1900F920B4 /* UMAPM.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D013CD1928582C1900F920B4 /* UMAPM.framework */; }; D013CD3228582C1900F920B4 /* UMAPM.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D013CD1928582C1900F920B4 /* UMAPM.framework */; };
D013CD3328582C1900F920B4 /* UMCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D013CD1C28582C1900F920B4 /* UMCommon.framework */; }; D013CD3328582C1900F920B4 /* UMCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D013CD1C28582C1900F920B4 /* UMCommon.framework */; };
...@@ -299,6 +300,8 @@ ...@@ -299,6 +300,8 @@
D0078C5D28E13DC400054804 /* DynamicDetailView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DynamicDetailView.m; 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>"; }; 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>"; }; D0078C6128E1425500054804 /* InteractView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InteractView.m; sourceTree = "<group>"; };
D0078C6D28E19C9F00054804 /* TextInputAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputAlertView.h; sourceTree = "<group>"; };
D0078C6E28E19C9F00054804 /* TextInputAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextInputAlertView.m; sourceTree = "<group>"; };
D00A63552824C42300AFFEAA /* DSNetworkCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSNetworkCache.h; 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>"; }; 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>"; }; D013CD1928582C1900F920B4 /* UMAPM.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UMAPM.framework; sourceTree = "<group>"; };
...@@ -1439,12 +1442,14 @@ ...@@ -1439,12 +1442,14 @@
D0A3BB9128D95A2B00F58781 /* CommunityView.m */, D0A3BB9128D95A2B00F58781 /* CommunityView.m */,
D070A78928DEF2D30039C5A7 /* DynamicView.h */, D070A78928DEF2D30039C5A7 /* DynamicView.h */,
D070A78A28DEF2D30039C5A7 /* DynamicView.m */, D070A78A28DEF2D30039C5A7 /* DynamicView.m */,
D0078C5628E13A1200054804 /* MKPPlaceholderTextView.h */,
D0078C5728E13A1200054804 /* MKPPlaceholderTextView.m */,
D0078C5C28E13DC400054804 /* DynamicDetailView.h */, D0078C5C28E13DC400054804 /* DynamicDetailView.h */,
D0078C5D28E13DC400054804 /* DynamicDetailView.m */, D0078C5D28E13DC400054804 /* DynamicDetailView.m */,
D0078C6028E1425500054804 /* InteractView.h */, D0078C6028E1425500054804 /* InteractView.h */,
D0078C6128E1425500054804 /* InteractView.m */, D0078C6128E1425500054804 /* InteractView.m */,
D0078C5628E13A1200054804 /* MKPPlaceholderTextView.h */,
D0078C5728E13A1200054804 /* MKPPlaceholderTextView.m */,
D0078C6D28E19C9F00054804 /* TextInputAlertView.h */,
D0078C6E28E19C9F00054804 /* TextInputAlertView.m */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2398,6 +2403,7 @@ ...@@ -2398,6 +2403,7 @@
D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */, D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */,
D0E65FFF2807AC5E006562F2 /* DSProgressHUD.m in Sources */, D0E65FFF2807AC5E006562F2 /* DSProgressHUD.m in Sources */,
D0496798283484CC00FB81E5 /* ProfileTableView.m in Sources */, D0496798283484CC00FB81E5 /* ProfileTableView.m in Sources */,
D0078C6F28E19C9F00054804 /* TextInputAlertView.m in Sources */,
D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */, D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */,
D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */, D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */,
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */, D0E6600828080F97006562F2 /* SystemSetController.m in Sources */,
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
// //
#import "InteractView.h" #import "InteractView.h"
#import "MKPPlaceholderTextView.h" #import "TextInputAlertView.h"
@interface InteractView () @interface InteractView ()
@property (nonatomic, strong) MKPPlaceholderTextView *textView; @property (nonatomic, strong) UILabel *tapLab;
@property (nonatomic, strong) UIButton *likeBtn; @property (nonatomic, strong) UIButton *likeBtn;
@property (nonatomic, strong) UIButton *remarkCountBtn; @property (nonatomic, strong) UIButton *remarkCountBtn;
@property (nonatomic, strong) TextInputAlertView *textInputAlertView;
@end @end
@implementation InteractView @implementation InteractView
...@@ -20,11 +21,11 @@ ...@@ -20,11 +21,11 @@
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG); self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self addSubview:self.textView]; [self addSubview:self.tapLab];
[self addSubview:self.likeBtn]; [self addSubview:self.likeBtn];
[self addSubview:self.remarkCountBtn]; [self addSubview:self.remarkCountBtn];
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) { [self.tapLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self); make.centerY.equalTo(self);
make.height.equalTo(@32); make.height.equalTo(@32);
make.left.equalTo(self).offset(15); make.left.equalTo(self).offset(15);
...@@ -40,28 +41,26 @@ ...@@ -40,28 +41,26 @@
make.centerY.equalTo(self); make.centerY.equalTo(self);
make.size.mas_equalTo(CGSizeMake(100, 30)); 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; return self;
} }
- (void)popTextInputView {
[self.textInputAlertView showTextInputAlertView];
}
#pragma mark - lazy #pragma mark - lazy
- (MKPPlaceholderTextView *)textView { - (UILabel *)tapLab {
if (!_textView) { if (!_tapLab) {
_textView = [MKPPlaceholderTextView new]; _tapLab = [UILabel labWithText:@" 回复楼主..." font:SysFont(12) fit:NO];
_textView.font = SysFont(12); [_tapLab cornerRadius:16.5];
[_textView cornerRadius:16.5]; _tapLab.userInteractionEnabled = YES;
_textView.placeholder = @"说点什么..."; _tapLab.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, DSWhite, DSWhite);
UIEdgeInsets oldInsets = _textView.textContainerInset; _tapLab.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, CornerViewDarkColor, DSWhite);
_textView.textContainerInset = UIEdgeInsetsMake(oldInsets.top, 12, oldInsets.bottom, 12); UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(popTextInputView)];
_textView.placeholderLabel.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, DSWhite, DSWhite); [_tapLab addGestureRecognizer:tapGR];
_textView.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DSWhite, DSWhite);
_textView.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, DarkColor, DSWhite);
} }
return _textView; return _tapLab;
} }
- (UIButton *)likeBtn { - (UIButton *)likeBtn {
...@@ -84,4 +83,11 @@ ...@@ -84,4 +83,11 @@
return _remarkCountBtn; return _remarkCountBtn;
} }
- (TextInputAlertView *)textInputAlertView {
if (!_textInputAlertView) {
_textInputAlertView = [[TextInputAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds];
}
return _textInputAlertView;
}
@end @end
//
// TextInputAlertView.h
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 文本评论弹框
@interface TextInputAlertView : UIView
- (void)showTextInputAlertView;
@end
NS_ASSUME_NONNULL_END
//
// TextInputAlertView.m
// DreamSleep
//
// Created by peter on 2022/9/26.
//
#import "TextInputAlertView.h"
#import "MKPPlaceholderTextView.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
@interface TextInputAlertView ()
@property (nonatomic, strong) UIView *alertView;
@property (nonatomic, strong) MKPPlaceholderTextView *textView;
@property (nonatomic, strong) UIButton *cancelBtn;
@property (nonatomic, strong) UIButton *replyBtn;
@property (nonatomic, assign) CGFloat duration;
@end
@implementation TextInputAlertView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHexA(0x161E38, .6), DSClearColor, DSWhite);
[self addSubview:self.alertView];
[self.alertView addSubview:self.cancelBtn];
[self.alertView addSubview:self.replyBtn];
[self.alertView addSubview:self.textView];
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.alertView).offset(25);
make.top.equalTo(self.alertView).offset(18);
}];
[self.replyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.alertView).offset(-15);
make.centerY.equalTo(self.cancelBtn);
make.size.mas_equalTo(CGSizeMake(44, 26));
}];
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.alertView).offset(15);
make.right.equalTo(self.alertView).offset(-15);
make.top.equalTo(self.alertView).offset(53);
make.bottom.equalTo(self.alertView);
}];
[[IQKeyboardManager sharedManager] setEnable:NO];
[[IQKeyboardManager sharedManager] setEnableAutoToolbar:NO];
[[IQKeyboardManager sharedManager] setShouldResignOnTouchOutside:NO];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillAppear:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDisappear:) name:UIKeyboardWillHideNotification object:nil];
}
return self;
}
- (void)keyboardWillAppear:(NSNotification *)noti {
NSDictionary *info = [noti userInfo];
NSValue *value = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
self.duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
CGSize keyboardSize = [value CGRectValue].size;
[UIView animateWithDuration:self.duration animations:^{
self.alertView.y = kScreenHeight - self.alertView.height - keyboardSize.height;
}];
}
- (void)keyboardWillDisappear:(NSNotification *)noti {
[UIView animateWithDuration:self.duration animations:^{
self.alertView.y = kScreenHeight;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
- (void)dealloc {
[[IQKeyboardManager sharedManager] setEnable:YES];
[[IQKeyboardManager sharedManager] setEnableAutoToolbar:YES];
[[IQKeyboardManager sharedManager] setShouldResignOnTouchOutside:YES];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
}
#pragma mark - public
- (void)showTextInputAlertView {
[DSKeyWindow addSubview:self];
[self.textView becomeFirstResponder];
}
#pragma mark - private
- (void)cancelAction {
[self.textView endEditing:YES];
}
- (void)replyAction {
// 1、调用回复接口
// 2、隐藏输入框
[self.textView endEditing:YES];
}
#pragma mark - lazy
- (UIView *)alertView {
if (!_alertView) {
_alertView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight, kScreenWidth, 201)];
[_alertView setCornerRadiusRect:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadius:24];
_alertView.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, DarkColor, DSWhite);
}
return _alertView;
}
- (MKPPlaceholderTextView *)textView {
if (!_textView) {
_textView = [MKPPlaceholderTextView new];
_textView.font = SysFont(14);
[_textView cornerRadius:12];
_textView.textContainerInset = UIEdgeInsetsMake(15, 8, 33, 8);
_textView.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, DSWhite, DSWhite);
_textView.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xF0F0F0), DarkColor, DSWhite);
}
return _textView;
}
- (UIButton *)cancelBtn {
if (!_cancelBtn) {
_cancelBtn = [UIButton btnWithTitle:@"取消" font:SysFont(14)];
[_cancelBtn dk_setTitleColorPicker:DKColorPickerWithColors(SubTitleColor, DSWhite, DSWhite) forState:UIControlStateNormal];
[_cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside];
}
return _cancelBtn;
}
- (UIButton *)replyBtn {
if (!_replyBtn) {
_replyBtn = [UIButton btnWithTitle:@"回复" titleColor:DSWhite font:SysFont(12) bgColor:BrandColor];
[_replyBtn cornerRadius:13];
[_replyBtn addTarget:self action:@selector(replyAction) forControlEvents:UIControlEventTouchUpInside];
}
return _replyBtn;
}
@end
...@@ -101,7 +101,9 @@ ...@@ -101,7 +101,9 @@
CGFloat bannerH = 2*(kScreenWidth - 48)/5.0; CGFloat bannerH = 2*(kScreenWidth - 48)/5.0;
// 哄睡按钮宽度 // 哄睡按钮宽度
CGFloat width = kScreenWidth - 2*15 - 12; CGFloat width = kScreenWidth - 2*15 - 12;
CGFloat height = 15 + bannerH + 24 + (170*.3*width/104.0); // 睡前故事区域高度
CGFloat sleepStoryH = 64;
CGFloat height = 15 + bannerH + 24 + (170*.3*width/104.0) + sleepStoryH;
_headerView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)]; _headerView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)];
_headerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG); _headerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#import "HeaderDataModel.h" #import "HeaderDataModel.h"
#import "DsMiddleView.h" #import "DsMiddleView.h"
#import "UnityGameController.h" #import "UnityGameController.h"
#import "SleepStoryController.h"
@interface HomeHeaderView () <CWCarouselDatasource, CWCarouselDelegate> @interface HomeHeaderView () <CWCarouselDatasource, CWCarouselDelegate>
// 轮播图 // 轮播图
...@@ -19,6 +20,8 @@ ...@@ -19,6 +20,8 @@
@property (nonatomic, strong) NSArray *bannerDatas; @property (nonatomic, strong) NSArray *bannerDatas;
// 哄睡、呼吸法区域 // 哄睡、呼吸法区域
@property (nonatomic, strong) DsMiddleView *dsMiddleView; @property (nonatomic, strong) DsMiddleView *dsMiddleView;
// 睡前故事区域
@property (nonatomic, strong) UIButton *storyView;
@end @end
@implementation HomeHeaderView @implementation HomeHeaderView
...@@ -28,6 +31,7 @@ ...@@ -28,6 +31,7 @@
self.bannerDatas = [NSArray array]; self.bannerDatas = [NSArray array];
[self addSubview:self.barnnerView]; [self addSubview:self.barnnerView];
[self addSubview:self.dsMiddleView]; [self addSubview:self.dsMiddleView];
[self addSubview:self.storyView];
} }
return self; return self;
} }
...@@ -157,4 +161,20 @@ ...@@ -157,4 +161,20 @@
return _dsMiddleView; return _dsMiddleView;
} }
- (UIButton *)storyView {
if (!_storyView) {
CGFloat height = 40;
WS(weakSelf);
_storyView = [[UIButton alloc] initWithFrame:CGRectMake(15, self.height - height, kScreenWidth - 30, 40)];
[_storyView setTitle:@"睡前故事" forState:UIControlStateNormal];
[_storyView setTitleColor:MainTextColor forState:UIControlStateNormal];
[_storyView debugViewShowBorder];
[_storyView cornerRadius:8.0];
[_storyView addTouchUpInsideHandler:^(NSInteger tag) {
[weakSelf.ds_viewController.navigationController pushViewController:[SleepStoryController new] animated:YES];
}];
}
return _storyView;
}
@end @end
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!