处理UI
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "tab_shequ_selected@2x.png",
|
||||
"filename" : "切图 145@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "tab_shequ_selected@3x.png",
|
||||
"filename" : "切图 145@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.9 KiB |
BIN
keyBoard/Assets.xcassets/Tabbar/tab_shequ_selected.imageset/切图 145@2x.png
vendored
Normal file
BIN
keyBoard/Assets.xcassets/Tabbar/tab_shequ_selected.imageset/切图 145@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
keyBoard/Assets.xcassets/Tabbar/tab_shequ_selected.imageset/切图 145@3x.png
vendored
Normal file
BIN
keyBoard/Assets.xcassets/Tabbar/tab_shequ_selected.imageset/切图 145@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@@ -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 {
|
||||
|
||||
@@ -124,6 +124,13 @@
|
||||
for (NSInteger i = 0; i < self.buttons.count; i++) {
|
||||
UIButton *button = self.buttons[i];
|
||||
button.selected = (i == self.selectedIndex);
|
||||
|
||||
// 特殊处理:社区按钮(索引2)选中时文字颜色为白色
|
||||
if (i == 2 && button.selected) {
|
||||
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
|
||||
} else if (i == 2) {
|
||||
[button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user