This commit is contained in:
2025-11-17 16:42:32 +08:00
parent f366a4aa6c
commit ea4b8168b7
2 changed files with 57 additions and 88 deletions

View File

@@ -36,11 +36,11 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
// Skip TabBar // Skip TabBar
BOOL hasShownSexVC = [[NSUserDefaults standardUserDefaults] boolForKey:KBSexSelectShownKey]; BOOL hasShownSexVC = [[NSUserDefaults standardUserDefaults] boolForKey:KBSexSelectShownKey];
if (hasShownSexVC) { // if (hasShownSexVC) {
[self setupRootVC]; // [self setupRootVC];
} else { // } else {
[self setupSexSelectRootVC]; [self setupSexSelectRootVC];
} // }
// 访 // 访
[KBNetworkManager shared].enabled = YES; [KBNetworkManager shared].enabled = YES;

View File

@@ -10,7 +10,6 @@
@interface KBSexSelVC () @interface KBSexSelVC ()
// //
@property (nonatomic, strong) UIView *topBgView; //
@property (nonatomic, strong) UIImageView *arrowImageView; // @property (nonatomic, strong) UIImageView *arrowImageView; //
@property (nonatomic, strong) UILabel *titleLabel; // @property (nonatomic, strong) UILabel *titleLabel; //
@property (nonatomic, strong) UIView *titleUnderlineView; // 线 @property (nonatomic, strong) UIView *titleUnderlineView; // 线
@@ -36,7 +35,8 @@
@property (nonatomic, strong) UIButton *confirmButton; // Turn On The Keyboard @property (nonatomic, strong) UIButton *confirmButton; // Turn On The Keyboard
// //
@property (nonatomic, strong) CAGradientLayer *topGradientLayer; //@property (nonatomic, strong) CAGradientLayer *topGradientLayer;
@property (nonatomic, strong) UIImageView *bgImageView; //
@end @end
@@ -47,14 +47,19 @@
// 使 // 使
self.kb_enableCustomNavBar = NO; self.kb_enableCustomNavBar = NO;
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my_bg_icon"]];
self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[self setupUI]; [self setupUI];
} }
- (void)viewDidLayoutSubviews { - (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews]; [super viewDidLayoutSubviews];
// //
self.topGradientLayer.frame = self.topBgView.bounds; // self.topGradientLayer.frame = self.topBgView.bounds;
} }
#pragma mark - Setup UI #pragma mark - Setup UI
@@ -62,126 +67,109 @@
/// UI /// UI
- (void)setupUI { - (void)setupUI {
// //
[self.view addSubview:self.topBgView]; [self.view addSubview:self.arrowImageView];
[self.topBgView addSubview:self.arrowImageView]; [self.view addSubview:self.titleLabel];
[self.topBgView addSubview:self.titleLabel]; [self.view addSubview:self.titleUnderlineView];
[self.topBgView addSubview:self.titleUnderlineView];
[self.view addSubview:self.skipButton]; [self.view addSubview:self.skipButton];
// //
[self.view addSubview:self.maleCardView]; [self.view addSubview:self.maleCardView];
[self.maleCardView addSubview:self.maleImageView]; [self.view addSubview:self.maleImageView];
[self.maleCardView addSubview:self.maleLabel]; [self.maleCardView addSubview:self.maleLabel];
[self.view addSubview:self.femaleCardView]; [self.view addSubview:self.femaleCardView];
[self.femaleCardView addSubview:self.femaleImageView]; [self.view addSubview:self.femaleImageView];
[self.femaleCardView addSubview:self.femaleLabel]; [self.femaleCardView addSubview:self.femaleLabel];
[self.view addSubview:self.otherCardView]; [self.view addSubview:self.otherCardView];
[self.otherCardView addSubview:self.otherLeftImageView]; [self.view addSubview:self.otherLeftImageView];
[self.otherCardView addSubview:self.otherRightImageView]; [self.view addSubview:self.otherRightImageView];
[self.otherCardView addSubview:self.otherLabel]; [self.otherCardView addSubview:self.otherLabel];
// //
[self.view addSubview:self.confirmButton]; [self.view addSubview:self.confirmButton];
//
[self.topBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.equalTo(self.view);
make.height.mas_equalTo(240);
}];
// //
[self.skipButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.skipButton mas_makeConstraints:^(MASConstraintMaker *make) {
if (@available(iOS 11.0, *)) { make.top.equalTo(self.view).offset(54);
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(8);
} else {
make.top.equalTo(self.view).offset(30);
}
make.right.equalTo(self.view).offset(-16); make.right.equalTo(self.view).offset(-16);
make.height.mas_equalTo(32); make.height.mas_equalTo(32);
make.width.mas_greaterThanOrEqualTo(64); make.width.mas_greaterThanOrEqualTo(64);
}]; }];
;
//
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(28); make.centerX.equalTo(self.view);
make.bottom.equalTo(self.topBgView.mas_bottom).offset(-48); make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT + 40);
}];
[self.titleUnderlineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel.mas_left);
make.right.lessThanOrEqualTo(self.topBgView).offset(-40);
make.top.equalTo(self.titleLabel.mas_bottom).offset(8);
make.height.mas_equalTo(4);
}]; }];
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) { [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.topBgView).offset(-40); make.right.equalTo(self.view).offset(-KBFit(90));
make.top.equalTo(self.topBgView).offset(40); make.top.equalTo(self.skipButton).offset(KBFit(15));
make.width.mas_equalTo(90); make.width.mas_equalTo(KBFit(220));
make.height.mas_equalTo(90); make.height.mas_equalTo(KBFit(99));
}]; }];
// //
[self.maleCardView mas_makeConstraints:^(MASConstraintMaker *make) { [self.maleCardView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(20); make.left.equalTo(self.view).offset(20);
make.right.equalTo(self.view).offset(-20); make.right.equalTo(self.view).offset(-20);
make.top.equalTo(self.topBgView.mas_bottom).offset(-10); // make.top.equalTo(self.arrowImageView.mas_bottom).offset(65);
make.height.mas_equalTo(128); make.height.mas_equalTo(KBFit(88));
}]; }];
[self.maleImageView mas_makeConstraints:^(MASConstraintMaker *make) { [self.maleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.maleCardView).offset(12); make.left.equalTo(self.maleCardView).offset(20);
make.centerY.equalTo(self.maleCardView); make.bottom.equalTo(self.maleCardView).offset(-2);
make.width.mas_equalTo(110); make.width.mas_equalTo(110);
make.height.mas_equalTo(110); make.height.mas_equalTo(140);
}]; }];
[self.maleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.maleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.maleCardView); make.centerY.equalTo(self.maleCardView);
make.right.equalTo(self.maleCardView).offset(-24); make.right.equalTo(self.maleCardView).offset(-60);
}]; }];
// //
[self.femaleCardView mas_makeConstraints:^(MASConstraintMaker *make) { [self.femaleCardView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.maleCardView); make.left.right.equalTo(self.maleCardView);
make.top.equalTo(self.maleCardView.mas_bottom).offset(24); make.top.equalTo(self.maleCardView.mas_bottom).offset(65);
make.height.mas_equalTo(110); make.height.equalTo(self.maleCardView);
}]; }];
[self.femaleImageView mas_makeConstraints:^(MASConstraintMaker *make) { [self.femaleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.femaleCardView).offset(-12); make.right.equalTo(self.femaleCardView).offset(-12);
make.centerY.equalTo(self.femaleCardView); make.bottom.equalTo(self.femaleCardView).offset(-2);
make.width.mas_equalTo(110); make.width.mas_equalTo(120);
make.height.mas_equalTo(110); make.height.mas_equalTo(133);
}]; }];
[self.femaleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.femaleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.femaleCardView).offset(24); make.left.equalTo(self.femaleCardView).offset(60);
make.centerY.equalTo(self.femaleCardView); make.centerY.equalTo(self.femaleCardView);
}]; }];
// //
[self.otherCardView mas_makeConstraints:^(MASConstraintMaker *make) { [self.otherCardView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.maleCardView); make.left.right.equalTo(self.maleCardView);
make.top.equalTo(self.femaleCardView.mas_bottom).offset(24); make.top.equalTo(self.femaleCardView.mas_bottom).offset(47);
make.height.mas_equalTo(96); make.height.equalTo(self.maleCardView);
}]; }];
[self.otherLeftImageView mas_makeConstraints:^(MASConstraintMaker *make) { [self.otherLeftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.otherCardView).offset(16); make.left.equalTo(self.otherCardView).offset(16);
make.centerY.equalTo(self.otherCardView); make.top.equalTo(self.otherCardView).offset(-15);
make.width.mas_equalTo(54); make.width.mas_equalTo(54);
make.height.mas_equalTo(54); make.height.mas_equalTo(72);
}]; }];
[self.otherRightImageView mas_makeConstraints:^(MASConstraintMaker *make) { [self.otherRightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.otherCardView).offset(-16); make.right.equalTo(self.otherCardView);
make.centerY.equalTo(self.otherCardView); make.bottom.equalTo(self.otherCardView);
make.width.mas_equalTo(54); make.width.mas_equalTo(36);
make.height.mas_equalTo(54); make.height.mas_equalTo(41);
}]; }];
[self.otherLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.otherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -192,12 +180,9 @@
// //
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.maleCardView); make.left.right.equalTo(self.maleCardView);
make.height.mas_equalTo(54); make.height.mas_equalTo(60);
if (@available(iOS 11.0, *)) {
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-24); make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-24);
} else {
make.bottom.equalTo(self.view).offset(-24);
}
}]; }];
} }
@@ -225,22 +210,6 @@
#pragma mark - Lazy UI #pragma mark - Lazy UI
- (UIView *)topBgView {
if (!_topBgView) {
_topBgView = [UIView new];
// 绿
CAGradientLayer *layer = [CAGradientLayer layer];
layer.colors = @[
(__bridge id)[UIColor colorWithHex:0xE4FFF6].CGColor,
(__bridge id)[UIColor colorWithHex:0xFFFFFF].CGColor
];
layer.startPoint = CGPointMake(0.5, 0.0);
layer.endPoint = CGPointMake(0.5, 1.0);
[_topBgView.layer insertSublayer:layer atIndex:0];
self.topGradientLayer = layer;
}
return _topBgView;
}
- (UIImageView *)arrowImageView { - (UIImageView *)arrowImageView {
if (!_arrowImageView) { if (!_arrowImageView) {
@@ -318,7 +287,7 @@
- (UIView *)femaleCardView { - (UIView *)femaleCardView {
if (!_femaleCardView) { if (!_femaleCardView) {
_femaleCardView = [UIView new]; _femaleCardView = [UIView new];
_femaleCardView.backgroundColor = [UIColor colorWithHex:0xF6F8FC]; _femaleCardView.backgroundColor = [UIColor colorWithHex:0xFAFAFA];
_femaleCardView.layer.cornerRadius = 24.0; _femaleCardView.layer.cornerRadius = 24.0;
_femaleCardView.layer.masksToBounds = YES; _femaleCardView.layer.masksToBounds = YES;
} }
@@ -346,7 +315,7 @@
- (UIView *)otherCardView { - (UIView *)otherCardView {
if (!_otherCardView) { if (!_otherCardView) {
_otherCardView = [UIView new]; _otherCardView = [UIView new];
_otherCardView.backgroundColor = [UIColor colorWithHex:0xFDFDFD]; _otherCardView.backgroundColor = [UIColor colorWithHex:0xFAFAFA];
_otherCardView.layer.cornerRadius = 24.0; _otherCardView.layer.cornerRadius = 24.0;
_otherCardView.layer.masksToBounds = YES; _otherCardView.layer.masksToBounds = YES;
} }
@@ -355,7 +324,7 @@
- (UIImageView *)otherLeftImageView { - (UIImageView *)otherLeftImageView {
if (!_otherLeftImageView) { if (!_otherLeftImageView) {
_otherLeftImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_othersmall_icon"]]; _otherLeftImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_otherbig_icon"]];
_otherLeftImageView.contentMode = UIViewContentModeScaleAspectFit; _otherLeftImageView.contentMode = UIViewContentModeScaleAspectFit;
} }
return _otherLeftImageView; return _otherLeftImageView;
@@ -363,7 +332,7 @@
- (UIImageView *)otherRightImageView { - (UIImageView *)otherRightImageView {
if (!_otherRightImageView) { if (!_otherRightImageView) {
_otherRightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_otherbig_icon"]]; _otherRightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_othersmall_icon"]];
_otherRightImageView.contentMode = UIViewContentModeScaleAspectFit; _otherRightImageView.contentMode = UIViewContentModeScaleAspectFit;
} }
return _otherRightImageView; return _otherRightImageView;
@@ -386,7 +355,7 @@
[_confirmButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [_confirmButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_confirmButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold]; _confirmButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
_confirmButton.backgroundColor = [UIColor blackColor]; _confirmButton.backgroundColor = [UIColor blackColor];
_confirmButton.layer.cornerRadius = 27.0; _confirmButton.layer.cornerRadius = 30;
_confirmButton.layer.masksToBounds = YES; _confirmButton.layer.masksToBounds = YES;
[_confirmButton addTarget:self action:@selector(onConfirmTapped) forControlEvents:UIControlEventTouchUpInside]; [_confirmButton addTarget:self action:@selector(onConfirmTapped) forControlEvents:UIControlEventTouchUpInside];
} }