处理tabbar

This commit is contained in:
2026-01-19 19:14:20 +08:00
parent 063ceae10f
commit d1d47336c2
7 changed files with 365 additions and 218 deletions

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
/// AI 语音陪伴聊天主界面
@interface KBAiMainVC : UIViewController
@interface KBAiMainVC : BaseViewController
@end

View File

@@ -46,6 +46,11 @@
[self setupOrchestrator];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// TabBar BaseTabBarController
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
@@ -56,55 +61,16 @@
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
//
if (!self.gradientLayer) {
self.gradientLayer = [CAGradientLayer layer];
self.gradientLayer.startPoint = CGPointMake(0.53, 1); //
self.gradientLayer.endPoint = CGPointMake(0.54, 0); //
// 24%
self.gradientLayer.colors = @[
(__bridge id)[UIColor colorWithRed:0 / 255.0
green:0 / 255.0
blue:0 / 255.0
alpha:0.24]
.CGColor,
(__bridge id)[UIColor colorWithRed:3 / 255.0
green:3 / 255.0
blue:3 / 255.0
alpha:0]
.CGColor
];
self.gradientLayer.locations = @[ @(0.7), @(1.0) ];
[self.tabbarBackgroundView.layer addSublayer:self.gradientLayer];
// mask framemask setupUI
if (self.blurEffectView.layer.mask) {
self.blurEffectView.layer.mask.frame = self.blurEffectView.bounds;
}
// frame
self.gradientLayer.frame = self.tabbarBackgroundView.bounds;
// blurEffectView
// mask
if (!self.blurEffectView.layer.mask) {
CAGradientLayer *maskLayer = [CAGradientLayer layer];
maskLayer.startPoint = CGPointMake(0.5, 1); //
maskLayer.endPoint = CGPointMake(0.5, 0); //
//
maskLayer.colors = @[
(__bridge id)[UIColor whiteColor].CGColor, //
(__bridge id)[UIColor whiteColor].CGColor, //
(__bridge id)[UIColor clearColor].CGColor //
];
maskLayer.locations = @[ @(0.0), @(0.5), @(1.0) ];
self.blurEffectView.layer.mask = maskLayer;
}
// mask frame
self.blurEffectView.layer.mask.frame = self.blurEffectView.bounds;
}
#pragma mark - UI Setup
- (void)setupUI {
self.view.backgroundColor = [UIColor systemBackgroundColor];
self.view.backgroundColor = [UIColor whiteColor];
self.title = @"AI 助手";
//
@@ -131,7 +97,19 @@
self.blurEffectView.translatesAutoresizingMaskIntoConstraints = NO;
[self.tabbarBackgroundView addSubview:self.blurEffectView];
// viewDidLayoutSubviews
// blurEffectView
// mask
CAGradientLayer *maskLayer = [CAGradientLayer layer];
maskLayer.startPoint = CGPointMake(0.5, 1); //
maskLayer.endPoint = CGPointMake(0.5, 0); //
//
maskLayer.colors = @[
(__bridge id)[UIColor whiteColor].CGColor, //
(__bridge id)[UIColor whiteColor].CGColor, //
(__bridge id)[UIColor clearColor].CGColor //
];
maskLayer.locations = @[ @(0.0), @(0.5), @(1.0) ];
self.blurEffectView.layer.mask = maskLayer;
//
self.statusLabel = [[UILabel alloc] init];