70 lines
2.0 KiB
Objective-C
70 lines
2.0 KiB
Objective-C
//
|
|
// HomeMainVC.m
|
|
// keyBoard
|
|
//
|
|
// Created by Mac on 2025/11/6.
|
|
//
|
|
|
|
#import "HomeMainVC.h"
|
|
#import "HomeHeadView.h"
|
|
#import "KBPanModalView.h"
|
|
|
|
@interface HomeMainVC ()
|
|
@property (nonatomic, strong) HomeHeadView *headView;
|
|
@property (nonatomic, strong) KBPanModalView *simplePanModalView;
|
|
|
|
@end
|
|
|
|
@implementation HomeMainVC
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
|
|
// self.view.backgroundColor = [UIColor yellowColor];
|
|
UIImage *bgImage = [UIImage kb_gradientImageWithColors:@[[UIColor colorWithHex:0xE8FFF1], [UIColor colorWithHex:0xD4FDFF]] size:CGSizeMake(KB_SCREEN_WIDTH, KB_SCREEN_HEIGHT) direction:KBGradientDirectionTopToBottom];
|
|
UIImageView *bgImageView = [[UIImageView alloc] init];
|
|
bgImageView.image = bgImage;
|
|
[self.view addSubview:bgImageView];
|
|
[bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self.view);
|
|
}];
|
|
CGFloat topV = (500);
|
|
|
|
// [self.view addSubview:self.headView];
|
|
// [self setupMas:topV];
|
|
// 创建sheetVC
|
|
self.simplePanModalView = [[KBPanModalView alloc] init];
|
|
// 使用宏,避免误写成函数指针判断导致恒为 true
|
|
if (KB_DEVICE_HAS_NOTCH) {
|
|
self.simplePanModalView.minHeight = KB_SCREEN_HEIGHT - topV - 34;
|
|
}else{
|
|
self.simplePanModalView.minHeight = KB_SCREEN_HEIGHT - topV;
|
|
//
|
|
}
|
|
self.simplePanModalView.topInset = 100;
|
|
[self.simplePanModalView presentInView:self.view];
|
|
HWBackgroundConfig *config = [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorDefault];
|
|
config.backgroundAlpha = 0;
|
|
[self.simplePanModalView.hw_dimmedView reloadConfig:config];
|
|
}
|
|
|
|
- (void)setupMas:(CGFloat)headViewTopV{
|
|
[self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.equalTo(self.view);
|
|
make.top.equalTo(self.view);
|
|
make.height.mas_equalTo(headViewTopV);
|
|
}];
|
|
}
|
|
|
|
|
|
#pragma mark - lazy
|
|
- (HomeHeadView *)headView{
|
|
if (!_headView) {
|
|
_headView = [[HomeHeadView alloc] init];
|
|
}
|
|
return _headView;
|
|
}
|
|
|
|
|
|
@end
|