1
@@ -25,6 +25,7 @@
|
||||
04122FB02EC73C0100EF7AB3 /* KBVipReviewItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 04122FAF2EC73C0100EF7AB3 /* KBVipReviewItemCell.m */; };
|
||||
04122FB32EC73C0100EF7AB3 /* KBVipReviewListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 04122FB22EC73C0100EF7AB3 /* KBVipReviewListCell.m */; };
|
||||
04286A002ECAEF2B00CE730C /* KBMoneyBtn.m in Sources */ = {isa = PBXBuildFile; fileRef = 042869FE2ECAEF2B00CE730C /* KBMoneyBtn.m */; };
|
||||
04286A032ECB0A1600CE730C /* KBSexSelVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 04286A022ECB0A1600CE730C /* KBSexSelVC.m */; };
|
||||
043FBCD22EAF97630036AFE1 /* KBPermissionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAE12EAF940F0089C901 /* KBPermissionViewController.m */; };
|
||||
0459D1B42EBA284C00F2D189 /* KBSkinCenterVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */; };
|
||||
0459D1B72EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; };
|
||||
@@ -231,6 +232,8 @@
|
||||
04122FB22EC73C0100EF7AB3 /* KBVipReviewListCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBVipReviewListCell.m; sourceTree = "<group>"; };
|
||||
042869FD2ECAEF2B00CE730C /* KBMoneyBtn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBMoneyBtn.h; sourceTree = "<group>"; };
|
||||
042869FE2ECAEF2B00CE730C /* KBMoneyBtn.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMoneyBtn.m; sourceTree = "<group>"; };
|
||||
04286A012ECB0A1600CE730C /* KBSexSelVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSexSelVC.h; sourceTree = "<group>"; };
|
||||
04286A022ECB0A1600CE730C /* KBSexSelVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSexSelVC.m; sourceTree = "<group>"; };
|
||||
0459D1B22EBA284C00F2D189 /* KBSkinCenterVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinCenterVC.h; sourceTree = "<group>"; };
|
||||
0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinCenterVC.m; sourceTree = "<group>"; };
|
||||
0459D1B52EBA287900F2D189 /* KBSkinManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinManager.h; sourceTree = "<group>"; };
|
||||
@@ -1203,6 +1206,8 @@
|
||||
04FC95E02EB20AD1007BD342 /* VC */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
04286A012ECB0A1600CE730C /* KBSexSelVC.h */,
|
||||
04286A022ECB0A1600CE730C /* KBSexSelVC.m */,
|
||||
04FC95DB2EB202A3007BD342 /* KBGuideVC.h */,
|
||||
04FC95DC2EB202A3007BD342 /* KBGuideVC.m */,
|
||||
);
|
||||
@@ -1624,6 +1629,7 @@
|
||||
04890A052EC0BBBB00FABA60 /* KBCategoryTitleImageView.m in Sources */,
|
||||
04FC95E92EB23B67007BD342 /* KBNetworkManager.m in Sources */,
|
||||
04FC95D22EB1E7AE007BD342 /* MyVC.m in Sources */,
|
||||
04286A032ECB0A1600CE730C /* KBSexSelVC.m in Sources */,
|
||||
047C65582EBCC06D0035E841 /* HomeRankCardCell.m in Sources */,
|
||||
04122F912EC73AF700EF7AB3 /* KBVipPay.m in Sources */,
|
||||
0477BE002EBC6A330055D639 /* HomeRankVC.m in Sources */,
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#import "KBLoginPopView.h"
|
||||
#import "IAPVerifyTransactionObj.h"
|
||||
#import "FGIAPManager.h"
|
||||
#import "KBSexSelVC.h"
|
||||
// 注意:用于判断系统已启用本输入法扩展的 bundle id 需与扩展 target 的
|
||||
// PRODUCT_BUNDLE_IDENTIFIER 完全一致。
|
||||
// 当前工程的 CustomKeyboard target 为 com.loveKey.nyx.CustomKeyboard
|
||||
@@ -32,11 +33,21 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// 1. 配置内购服务
|
||||
[[FGIAPManager shared] setConfigureWith:[IAPVerifyTransactionObj new]];
|
||||
|
||||
// 首次安装先进入性别选择页;点击 Skip 或确认后再进入主 TabBar
|
||||
BOOL hasShownSexVC = [[NSUserDefaults standardUserDefaults] boolForKey:KBSexSelectShownKey];
|
||||
if (hasShownSexVC) {
|
||||
[self setupRootVC];
|
||||
} else {
|
||||
[self setupSexSelectRootVC];
|
||||
}
|
||||
|
||||
// 主工程默认开启网络总开关(键盘扩展仍需用户允许完全访问后再行开启)
|
||||
[KBNetworkManager shared].enabled = YES;
|
||||
/// 获取网络权限
|
||||
[self getNetJudge];
|
||||
/// 触发一次简单网络请求,用于拉起系统的蜂窝数据权限弹窗
|
||||
[self kb_fireStartupNetworkRequest];
|
||||
|
||||
#if !DEBUG
|
||||
/// Bugly
|
||||
@@ -61,6 +72,24 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
|
||||
self.window.rootViewController = vc;
|
||||
}
|
||||
|
||||
/// 首次安装时,展示性别选择页作为根控制器
|
||||
- (void)setupSexSelectRootVC {
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
self.window.backgroundColor = [UIColor whiteColor];
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
KBSexSelVC *sexVC = [KBSexSelVC new];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
sexVC.didFinishSelectBlock = ^{
|
||||
// 记录已经展示过性别选择页,下次启动直接进 TabBar
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:KBSexSelectShownKey];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
// 切换根控制器到主 TabBar
|
||||
[weakSelf setupRootVC];
|
||||
};
|
||||
self.window.rootViewController = sexVC;
|
||||
}
|
||||
|
||||
#pragma mark - Permission presentation
|
||||
|
||||
|
||||
@@ -172,6 +201,24 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
|
||||
// 该逻辑已迁移到 KBGuideVC,保留占位以兼容旧调用,但不再执行任何操作
|
||||
}
|
||||
|
||||
/// 使用系统网络栈发起一次简单请求(例如拉起蜂窝数据权限弹窗)。
|
||||
/// 说明:只要真正访问网络,系统在需要时就会弹出“是否允许使用蜂窝数据”等提示。
|
||||
- (void)kb_fireStartupNetworkRequest {
|
||||
NSURL *url = [NSURL URLWithString:@"https://www.apple.com"];
|
||||
if (!url) { return; }
|
||||
|
||||
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
|
||||
NSURLSessionDataTask *task = [session dataTaskWithURL:url
|
||||
completionHandler:^(NSData * _Nullable data,
|
||||
NSURLResponse * _Nullable response,
|
||||
NSError * _Nullable error) {
|
||||
// 回到主线程弹出一个简单提示,证明网络请求已经发起
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
});
|
||||
}];
|
||||
[task resume];
|
||||
}
|
||||
|
||||
|
||||
-(void)getNetJudge {
|
||||
|
||||
22
keyBoard/Assets.xcassets/Ohter/sex_jiantou_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_jiantou_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_jiantou_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
keyBoard/Assets.xcassets/Ohter/sex_jiantou_icon.imageset/sex_jiantou_icon@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
keyBoard/Assets.xcassets/Ohter/sex_jiantou_icon.imageset/sex_jiantou_icon@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 25 KiB |
22
keyBoard/Assets.xcassets/Ohter/sex_nan_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_nan_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_nan_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
keyBoard/Assets.xcassets/Ohter/sex_nan_icon.imageset/sex_nan_icon@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
keyBoard/Assets.xcassets/Ohter/sex_nan_icon.imageset/sex_nan_icon@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 214 KiB |
22
keyBoard/Assets.xcassets/Ohter/sex_nv_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_nv_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_nv_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
keyBoard/Assets.xcassets/Ohter/sex_nv_icon.imageset/sex_nv_icon@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
keyBoard/Assets.xcassets/Ohter/sex_nv_icon.imageset/sex_nv_icon@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 219 KiB |
22
keyBoard/Assets.xcassets/Ohter/sex_otherbig_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_otherbig_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_otherbig_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
keyBoard/Assets.xcassets/Ohter/sex_otherbig_icon.imageset/sex_otherbig_icon@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
keyBoard/Assets.xcassets/Ohter/sex_otherbig_icon.imageset/sex_otherbig_icon@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 34 KiB |
22
keyBoard/Assets.xcassets/Ohter/sex_othersmall_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_othersmall_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "sex_othersmall_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
keyBoard/Assets.xcassets/Ohter/sex_othersmall_icon.imageset/sex_othersmall_icon@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
keyBoard/Assets.xcassets/Ohter/sex_othersmall_icon.imageset/sex_othersmall_icon@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 15 KiB |
22
keyBoard/Class/Guard/VC/KBSexSelVC.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// KBSexSelVC.h
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2025/11/17.
|
||||
// 性别选择
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 性别选择页
|
||||
/// 说明:只负责展示静态 UI 与首次进入时的引导。
|
||||
@interface KBSexSelVC : BaseViewController
|
||||
|
||||
/// 用户点击「Skip」或底部确认按钮后的回调。
|
||||
/// AppDelegate 通过该回调切换到主 TabBar。
|
||||
@property (nonatomic, copy, nullable) void (^didFinishSelectBlock)(void);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
396
keyBoard/Class/Guard/VC/KBSexSelVC.m
Normal file
@@ -0,0 +1,396 @@
|
||||
//
|
||||
// KBSexSelVC.m
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2025/11/17.
|
||||
// 性别选择页 UI
|
||||
|
||||
#import "KBSexSelVC.h"
|
||||
|
||||
@interface KBSexSelVC ()
|
||||
|
||||
// 顶部区域
|
||||
@property (nonatomic, strong) UIView *topBgView; // 顶部背景(渐变)
|
||||
@property (nonatomic, strong) UIImageView *arrowImageView; // 右上角箭头
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // 标题文案
|
||||
@property (nonatomic, strong) UIView *titleUnderlineView; // 标题下划线
|
||||
@property (nonatomic, strong) UIButton *skipButton; // 跳过按钮
|
||||
|
||||
// 性别选项 - 男
|
||||
@property (nonatomic, strong) UIView *maleCardView; // 男性卡片容器
|
||||
@property (nonatomic, strong) UIImageView *maleImageView; // 男性大头像
|
||||
@property (nonatomic, strong) UILabel *maleLabel; // “Male” 文案
|
||||
|
||||
// 性别选项 - 女
|
||||
@property (nonatomic, strong) UIView *femaleCardView; // 女性卡片容器
|
||||
@property (nonatomic, strong) UIImageView *femaleImageView; // 女性大头像
|
||||
@property (nonatomic, strong) UILabel *femaleLabel; // “Female” 文案
|
||||
|
||||
// 性别选项 - 第三性别
|
||||
@property (nonatomic, strong) UIView *otherCardView; // 第三性别卡片容器
|
||||
@property (nonatomic, strong) UIImageView *otherLeftImageView;// 左侧问号小图
|
||||
@property (nonatomic, strong) UIImageView *otherRightImageView;// 右侧问号小图
|
||||
@property (nonatomic, strong) UILabel *otherLabel; // “The Third Gender” 文案
|
||||
|
||||
// 底部按钮
|
||||
@property (nonatomic, strong) UIButton *confirmButton; // Turn On The Keyboard 按钮
|
||||
|
||||
// 渐变层
|
||||
@property (nonatomic, strong) CAGradientLayer *topGradientLayer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation KBSexSelVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// 使用全屏内容,不需要自定义导航栏
|
||||
self.kb_enableCustomNavBar = NO;
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
[self setupUI];
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
// 更新渐变背景尺寸
|
||||
self.topGradientLayer.frame = self.topBgView.bounds;
|
||||
}
|
||||
|
||||
#pragma mark - Setup UI
|
||||
|
||||
/// 构建静态 UI 布局
|
||||
- (void)setupUI {
|
||||
// 顶部区域
|
||||
[self.view addSubview:self.topBgView];
|
||||
[self.topBgView addSubview:self.arrowImageView];
|
||||
[self.topBgView addSubview:self.titleLabel];
|
||||
[self.topBgView addSubview:self.titleUnderlineView];
|
||||
[self.view addSubview:self.skipButton];
|
||||
|
||||
// 三个性别卡片
|
||||
[self.view addSubview:self.maleCardView];
|
||||
[self.maleCardView addSubview:self.maleImageView];
|
||||
[self.maleCardView addSubview:self.maleLabel];
|
||||
|
||||
[self.view addSubview:self.femaleCardView];
|
||||
[self.femaleCardView addSubview:self.femaleImageView];
|
||||
[self.femaleCardView addSubview:self.femaleLabel];
|
||||
|
||||
[self.view addSubview:self.otherCardView];
|
||||
[self.otherCardView addSubview:self.otherLeftImageView];
|
||||
[self.otherCardView addSubview:self.otherRightImageView];
|
||||
[self.otherCardView addSubview:self.otherLabel];
|
||||
|
||||
// 底部按钮
|
||||
[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) {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
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.height.mas_equalTo(32);
|
||||
make.width.mas_greaterThanOrEqualTo(64);
|
||||
}];
|
||||
|
||||
// 标题居左,靠近顶部背景下方
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(28);
|
||||
make.bottom.equalTo(self.topBgView.mas_bottom).offset(-48);
|
||||
}];
|
||||
|
||||
[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) {
|
||||
make.right.equalTo(self.topBgView).offset(-40);
|
||||
make.top.equalTo(self.topBgView).offset(40);
|
||||
make.width.mas_equalTo(90);
|
||||
make.height.mas_equalTo(90);
|
||||
}];
|
||||
|
||||
// 男性卡片
|
||||
[self.maleCardView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(20);
|
||||
make.right.equalTo(self.view).offset(-20);
|
||||
make.top.equalTo(self.topBgView.mas_bottom).offset(-10); // 略微上移,产生“压住”效果
|
||||
make.height.mas_equalTo(128);
|
||||
}];
|
||||
|
||||
[self.maleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.maleCardView).offset(12);
|
||||
make.centerY.equalTo(self.maleCardView);
|
||||
make.width.mas_equalTo(110);
|
||||
make.height.mas_equalTo(110);
|
||||
}];
|
||||
|
||||
[self.maleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.maleCardView);
|
||||
make.right.equalTo(self.maleCardView).offset(-24);
|
||||
}];
|
||||
|
||||
// 女性卡片
|
||||
[self.femaleCardView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.maleCardView);
|
||||
make.top.equalTo(self.maleCardView.mas_bottom).offset(24);
|
||||
make.height.mas_equalTo(110);
|
||||
}];
|
||||
|
||||
[self.femaleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.femaleCardView).offset(-12);
|
||||
make.centerY.equalTo(self.femaleCardView);
|
||||
make.width.mas_equalTo(110);
|
||||
make.height.mas_equalTo(110);
|
||||
}];
|
||||
|
||||
[self.femaleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.femaleCardView).offset(24);
|
||||
make.centerY.equalTo(self.femaleCardView);
|
||||
}];
|
||||
|
||||
// 第三性别卡片
|
||||
[self.otherCardView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.maleCardView);
|
||||
make.top.equalTo(self.femaleCardView.mas_bottom).offset(24);
|
||||
make.height.mas_equalTo(96);
|
||||
}];
|
||||
|
||||
[self.otherLeftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.otherCardView).offset(16);
|
||||
make.centerY.equalTo(self.otherCardView);
|
||||
make.width.mas_equalTo(54);
|
||||
make.height.mas_equalTo(54);
|
||||
}];
|
||||
|
||||
[self.otherRightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.otherCardView).offset(-16);
|
||||
make.centerY.equalTo(self.otherCardView);
|
||||
make.width.mas_equalTo(54);
|
||||
make.height.mas_equalTo(54);
|
||||
}];
|
||||
|
||||
[self.otherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.otherCardView);
|
||||
make.centerY.equalTo(self.otherCardView);
|
||||
}];
|
||||
|
||||
// 底部按钮
|
||||
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.maleCardView);
|
||||
make.height.mas_equalTo(54);
|
||||
if (@available(iOS 11.0, *)) {
|
||||
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-24);
|
||||
} else {
|
||||
make.bottom.equalTo(self.view).offset(-24);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
/// 点击跳过
|
||||
- (void)onSkipTapped {
|
||||
// 触发回调,让外部(如 AppDelegate)切换到主 TabBar
|
||||
if (self.didFinishSelectBlock) {
|
||||
self.didFinishSelectBlock();
|
||||
}
|
||||
[[NSUserDefaults standardUserDefaults] setBool:true forKey:KBSexSelectShownKey];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
/// 点击底部“打开键盘”按钮
|
||||
- (void)onConfirmTapped {
|
||||
// 触发回调,让外部(如 AppDelegate)切换到主 TabBar
|
||||
if (self.didFinishSelectBlock) {
|
||||
self.didFinishSelectBlock();
|
||||
}
|
||||
[[NSUserDefaults standardUserDefaults] setBool:true forKey:KBSexSelectShownKey];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
#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 {
|
||||
if (!_arrowImageView) {
|
||||
_arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_jiantou_icon"]];
|
||||
_arrowImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _arrowImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = @"Please Select Your Gender";
|
||||
_titleLabel.font = [UIFont systemFontOfSize:22 weight:UIFontWeightSemibold];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.numberOfLines = 1;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIView *)titleUnderlineView {
|
||||
if (!_titleUnderlineView) {
|
||||
_titleUnderlineView = [UIView new];
|
||||
_titleUnderlineView.backgroundColor = [UIColor colorWithHex:KBColorValue];
|
||||
_titleUnderlineView.layer.cornerRadius = 2.0;
|
||||
_titleUnderlineView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _titleUnderlineView;
|
||||
}
|
||||
|
||||
- (UIButton *)skipButton {
|
||||
if (!_skipButton) {
|
||||
_skipButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_skipButton setTitle:@"Skip" forState:UIControlStateNormal];
|
||||
[_skipButton setTitleColor:[UIColor colorWithHex:KBBlackValue] forState:UIControlStateNormal];
|
||||
_skipButton.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_skipButton.backgroundColor = [UIColor colorWithHex:0xE9F7F4];
|
||||
_skipButton.layer.cornerRadius = 16;
|
||||
_skipButton.layer.masksToBounds = YES;
|
||||
[_skipButton addTarget:self action:@selector(onSkipTapped) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _skipButton;
|
||||
}
|
||||
|
||||
- (UIView *)maleCardView {
|
||||
if (!_maleCardView) {
|
||||
_maleCardView = [UIView new];
|
||||
_maleCardView.backgroundColor = [UIColor whiteColor];
|
||||
_maleCardView.layer.cornerRadius = 24.0;
|
||||
_maleCardView.layer.masksToBounds = YES;
|
||||
_maleCardView.layer.borderWidth = 2.0;
|
||||
_maleCardView.layer.borderColor = [UIColor colorWithHex:KBColorValue].CGColor;
|
||||
}
|
||||
return _maleCardView;
|
||||
}
|
||||
|
||||
- (UIImageView *)maleImageView {
|
||||
if (!_maleImageView) {
|
||||
_maleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_nan_icon"]];
|
||||
_maleImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _maleImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)maleLabel {
|
||||
if (!_maleLabel) {
|
||||
_maleLabel = [UILabel new];
|
||||
_maleLabel.text = @"Male";
|
||||
_maleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||
_maleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
return _maleLabel;
|
||||
}
|
||||
|
||||
- (UIView *)femaleCardView {
|
||||
if (!_femaleCardView) {
|
||||
_femaleCardView = [UIView new];
|
||||
_femaleCardView.backgroundColor = [UIColor colorWithHex:0xF6F8FC];
|
||||
_femaleCardView.layer.cornerRadius = 24.0;
|
||||
_femaleCardView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _femaleCardView;
|
||||
}
|
||||
|
||||
- (UIImageView *)femaleImageView {
|
||||
if (!_femaleImageView) {
|
||||
_femaleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_nv_icon"]];
|
||||
_femaleImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _femaleImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)femaleLabel {
|
||||
if (!_femaleLabel) {
|
||||
_femaleLabel = [UILabel new];
|
||||
_femaleLabel.text = @"Female";
|
||||
_femaleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightRegular];
|
||||
_femaleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
return _femaleLabel;
|
||||
}
|
||||
|
||||
- (UIView *)otherCardView {
|
||||
if (!_otherCardView) {
|
||||
_otherCardView = [UIView new];
|
||||
_otherCardView.backgroundColor = [UIColor colorWithHex:0xFDFDFD];
|
||||
_otherCardView.layer.cornerRadius = 24.0;
|
||||
_otherCardView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _otherCardView;
|
||||
}
|
||||
|
||||
- (UIImageView *)otherLeftImageView {
|
||||
if (!_otherLeftImageView) {
|
||||
_otherLeftImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_othersmall_icon"]];
|
||||
_otherLeftImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _otherLeftImageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)otherRightImageView {
|
||||
if (!_otherRightImageView) {
|
||||
_otherRightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sex_otherbig_icon"]];
|
||||
_otherRightImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _otherRightImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)otherLabel {
|
||||
if (!_otherLabel) {
|
||||
_otherLabel = [UILabel new];
|
||||
_otherLabel.text = @"The Third Gender";
|
||||
_otherLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightRegular];
|
||||
_otherLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
return _otherLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)confirmButton {
|
||||
if (!_confirmButton) {
|
||||
_confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_confirmButton setTitle:@"Turn On The Keyboard" forState:UIControlStateNormal];
|
||||
[_confirmButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_confirmButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_confirmButton.backgroundColor = [UIColor blackColor];
|
||||
_confirmButton.layer.cornerRadius = 27.0;
|
||||
_confirmButton.layer.masksToBounds = YES;
|
||||
[_confirmButton addTarget:self action:@selector(onConfirmTapped) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _confirmButton;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -59,6 +59,9 @@
|
||||
#define KB_UL_LOGIN KB_UL_BASE @"/login"
|
||||
#define KB_UL_SETTINGS KB_UL_BASE @"/settings"
|
||||
|
||||
/// 第一次安装
|
||||
#define KBSexSelectShownKey @"kKBSexSelectShownKey"
|
||||
|
||||
/// UI 尺寸/设备宏
|
||||
// 屏幕尺寸
|
||||
#define KB_SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
|
||||
|
||||