添加评论
This commit is contained in:
@@ -7,18 +7,20 @@
|
||||
|
||||
#import "KBAiMainVC.h"
|
||||
#import "ConversationOrchestrator.h"
|
||||
#import "KBAICommentView.h"
|
||||
#import "KBAiChatView.h"
|
||||
#import "KBAiRecordButton.h"
|
||||
#import "KBAICommentView.h"
|
||||
#import "LSTPopView.h"
|
||||
|
||||
@interface KBAiMainVC () <KBAiRecordButtonDelegate>
|
||||
@property (nonatomic,weak) LSTPopView *popView;
|
||||
@property(nonatomic, weak) LSTPopView *popView;
|
||||
|
||||
// UI
|
||||
@property(nonatomic, strong) KBAiChatView *chatView;
|
||||
@property(nonatomic, strong) KBAiRecordButton *recordButton;
|
||||
@property(nonatomic, strong) UILabel *statusLabel;
|
||||
@property(nonatomic, strong) UIButton *commentButton;
|
||||
@property(nonatomic, strong) KBAICommentView *commentView;
|
||||
|
||||
// 核心模块
|
||||
@property(nonatomic, strong) ConversationOrchestrator *orchestrator;
|
||||
@@ -73,6 +75,23 @@
|
||||
self.recordButton.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.view addSubview:self.recordButton];
|
||||
|
||||
// 评论按钮(聊天视图右侧居中)
|
||||
self.commentButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[self.commentButton setImage:[UIImage systemImageNamed:@"bubble.right.fill"]
|
||||
forState:UIControlStateNormal];
|
||||
self.commentButton.tintColor = [UIColor whiteColor];
|
||||
self.commentButton.backgroundColor = [UIColor systemBlueColor];
|
||||
self.commentButton.layer.cornerRadius = 25;
|
||||
self.commentButton.layer.shadowColor = [UIColor blackColor].CGColor;
|
||||
self.commentButton.layer.shadowOffset = CGSizeMake(0, 2);
|
||||
self.commentButton.layer.shadowOpacity = 0.3;
|
||||
self.commentButton.layer.shadowRadius = 4;
|
||||
self.commentButton.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.commentButton addTarget:self
|
||||
action:@selector(showComment)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.view addSubview:self.commentButton];
|
||||
|
||||
// 布局约束
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
// 状态标签
|
||||
@@ -108,6 +127,15 @@
|
||||
constraintEqualToAnchor:safeArea.bottomAnchor
|
||||
constant:-16],
|
||||
[self.recordButton.heightAnchor constraintEqualToConstant:50],
|
||||
|
||||
// 评论按钮(右侧居中)
|
||||
[self.commentButton.trailingAnchor
|
||||
constraintEqualToAnchor:safeArea.trailingAnchor
|
||||
constant:-16],
|
||||
[self.commentButton.centerYAnchor
|
||||
constraintEqualToAnchor:self.chatView.centerYAnchor],
|
||||
[self.commentButton.widthAnchor constraintEqualToConstant:50],
|
||||
[self.commentButton.heightAnchor constraintEqualToConstant:50],
|
||||
]];
|
||||
}
|
||||
|
||||
@@ -211,24 +239,44 @@
|
||||
}
|
||||
|
||||
#pragma mark - 事件
|
||||
- (void)showComment{
|
||||
CGFloat customViewHeight = KB_SCREEN_HEIGHT*(0.8);
|
||||
KBAICommentView *customView = [[KBAICommentView alloc] initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, customViewHeight)];
|
||||
LSTPopView *popView = [LSTPopView initWithCustomView:customView
|
||||
parentView:self.view
|
||||
popStyle:LSTPopStyleSmoothFromBottom
|
||||
dismissStyle:LSTDismissStyleSmoothToBottom];
|
||||
self.popView = popView;
|
||||
popView.priority = 1000;
|
||||
popView.hemStyle = LSTHemStyleBottom;
|
||||
popView.dragStyle = LSTDragStyleY_Positive;
|
||||
popView.dragDistance = customViewHeight*0.5;
|
||||
popView.sweepStyle = LSTSweepStyleY_Positive;
|
||||
popView.swipeVelocity = 1600;
|
||||
popView.sweepDismissStyle = LSTSweepDismissStyleSmooth;
|
||||
- (void)showComment {
|
||||
CGFloat customViewHeight = KB_SCREEN_HEIGHT * (0.8);
|
||||
KBAICommentView *customView = [[KBAICommentView alloc]
|
||||
initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, customViewHeight)];
|
||||
LSTPopView *popView =
|
||||
[LSTPopView initWithCustomView:customView
|
||||
parentView:self.view
|
||||
popStyle:LSTPopStyleSmoothFromBottom
|
||||
dismissStyle:LSTDismissStyleSmoothToBottom];
|
||||
self.popView = popView;
|
||||
popView.priority = 1000;
|
||||
popView.hemStyle = LSTHemStyleBottom;
|
||||
popView.dragStyle = LSTDragStyleY_Positive;
|
||||
popView.dragDistance = customViewHeight * 0.5;
|
||||
popView.sweepStyle = LSTSweepStyleY_Positive;
|
||||
popView.swipeVelocity = 1600;
|
||||
popView.sweepDismissStyle = LSTSweepDismissStyleSmooth;
|
||||
|
||||
|
||||
[popView pop];
|
||||
[popView pop];
|
||||
}
|
||||
|
||||
- (void)showCommentDirectly {
|
||||
if (self.commentView.superview) {
|
||||
[self.view bringSubviewToFront:self.commentView];
|
||||
return;
|
||||
}
|
||||
|
||||
CGFloat customViewHeight = KB_SCREEN_HEIGHT * (0.8);
|
||||
KBAICommentView *customView = [[KBAICommentView alloc] initWithFrame:CGRectZero];
|
||||
customView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.view addSubview:customView];
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[customView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
|
||||
[customView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
|
||||
[customView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor],
|
||||
[customView.heightAnchor constraintEqualToConstant:customViewHeight],
|
||||
]];
|
||||
self.commentView = customView;
|
||||
}
|
||||
|
||||
#pragma mark - UI Updates
|
||||
|
||||
Reference in New Issue
Block a user