处理UI
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
@property (nonatomic, strong) UIView *bottomBackgroundView;
|
||||
@property (nonatomic, strong) UIVisualEffectView *bottomBlurEffectView;
|
||||
@property (nonatomic, strong) CAGradientLayer *bottomMaskLayer;
|
||||
@property (nonatomic, strong) CAGradientLayer *bottomGradientLayer;
|
||||
|
||||
/// 语音转写管理器
|
||||
@property (nonatomic, strong) KBVoiceToTextManager *voiceToTextManager;
|
||||
@@ -184,15 +185,15 @@ static NSString * const KBAISelectedPersonaIdKey = @"KBAISelectedPersonaId";
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
if (self.bottomMaskLayer) {
|
||||
self.bottomMaskLayer.frame = self.bottomBlurEffectView.bounds;
|
||||
if (self.bottomGradientLayer) {
|
||||
self.bottomGradientLayer.frame = self.bottomBackgroundView.bounds;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 1:控件初始化
|
||||
|
||||
- (void)setupUI {
|
||||
self.voiceInputBarHeight = 52;
|
||||
self.voiceInputBarHeight = 138;
|
||||
self.baseInputBarBottomSpacing = KB_TABBAR_HEIGHT;
|
||||
[self.view addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -891,32 +892,38 @@ static NSString * const KBAISelectedPersonaIdKey = @"KBAISelectedPersonaId";
|
||||
if (!_bottomBackgroundView) {
|
||||
_bottomBackgroundView = [[UIView alloc] init];
|
||||
_bottomBackgroundView.clipsToBounds = YES;
|
||||
// 添加渐变遮罩层,实现从底部到顶部的渐变显示效果
|
||||
_bottomBackgroundView.layer.mask = self.bottomGradientLayer;
|
||||
}
|
||||
return _bottomBackgroundView;
|
||||
}
|
||||
|
||||
- (UIVisualEffectView *)bottomBlurEffectView {
|
||||
if (!_bottomBlurEffectView) {
|
||||
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||
// 使用深色毛玻璃效果
|
||||
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
_bottomBlurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
|
||||
_bottomBlurEffectView.layer.mask = self.bottomMaskLayer;
|
||||
_bottomBlurEffectView.alpha = 0.9; // 稍微降低整体透明度
|
||||
}
|
||||
return _bottomBlurEffectView;
|
||||
}
|
||||
|
||||
- (CAGradientLayer *)bottomMaskLayer {
|
||||
if (!_bottomMaskLayer) {
|
||||
_bottomMaskLayer = [CAGradientLayer layer];
|
||||
_bottomMaskLayer.startPoint = CGPointMake(0.5, 1);
|
||||
_bottomMaskLayer.endPoint = CGPointMake(0.5, 0);
|
||||
_bottomMaskLayer.colors = @[
|
||||
(__bridge id)[UIColor whiteColor].CGColor,
|
||||
(__bridge id)[UIColor whiteColor].CGColor,
|
||||
(__bridge id)[UIColor clearColor].CGColor
|
||||
- (CAGradientLayer *)bottomGradientLayer {
|
||||
if (!_bottomGradientLayer) {
|
||||
_bottomGradientLayer = [CAGradientLayer layer];
|
||||
// 从底部到顶部
|
||||
_bottomGradientLayer.startPoint = CGPointMake(0.5, 1);
|
||||
_bottomGradientLayer.endPoint = CGPointMake(0.5, 0);
|
||||
// 作为遮罩层:底部完全不透明(白色),顶部完全透明(透明色)
|
||||
// 中间位置开始渐变,让底部区域保持完整的毛玻璃效果
|
||||
_bottomGradientLayer.colors = @[
|
||||
(__bridge id)[UIColor whiteColor].CGColor, // 底部:完全不透明
|
||||
(__bridge id)[UIColor whiteColor].CGColor, // 中间偏下:完全不透明
|
||||
(__bridge id)[[UIColor whiteColor] colorWithAlphaComponent:0.0].CGColor // 顶部:完全透明
|
||||
];
|
||||
_bottomMaskLayer.locations = @[@(0.0), @(0.5), @(1.0)];
|
||||
_bottomGradientLayer.locations = @[@(0.0), @(0.4), @(1.0)];
|
||||
}
|
||||
return _bottomMaskLayer;
|
||||
return _bottomGradientLayer;
|
||||
}
|
||||
|
||||
- (UIButton *)messageButton {
|
||||
|
||||
Reference in New Issue
Block a user