diff --git a/CustomKeyboard/View/KBEmojiPanelView.m b/CustomKeyboard/View/KBEmojiPanelView.m index 55a6055..87cf1d3 100644 --- a/CustomKeyboard/View/KBEmojiPanelView.m +++ b/CustomKeyboard/View/KBEmojiPanelView.m @@ -106,7 +106,7 @@ [topBar mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self); make.top.equalTo(self.mas_top).offset(4); - make.height.mas_equalTo(44); + make.height.mas_equalTo(40); }]; [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(topBar.mas_left).offset(12); @@ -151,14 +151,14 @@ self.tabStackView = [[UIStackView alloc] init]; self.tabStackView.axis = UILayoutConstraintAxisHorizontal; self.tabStackView.spacing = 8; - self.tabStackView.alignment = UIStackViewAlignmentCenter; + self.tabStackView.alignment = UIStackViewAlignmentFill; [self.tabScrollView addSubview:self.tabStackView]; [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.mas_left).offset(12); make.right.equalTo(self.mas_right).offset(-12); - make.top.equalTo(topBar.mas_bottom).offset(8); - make.bottom.equalTo(self.bottomBar.mas_top).offset(-8); + make.top.equalTo(topBar.mas_bottom).offset(0); + make.bottom.equalTo(self.bottomBar.mas_top).offset(0); }]; [self.bottomBar mas_makeConstraints:^(MASConstraintMaker *make) { @@ -177,8 +177,8 @@ make.left.equalTo(self.bottomBar.mas_left).offset(12); // make.right.equalTo(self.searchButton.mas_left).offset(-12); make.right.equalTo(self.bottomBar.mas_right).offset(-12); - make.top.equalTo(self.bottomBar.mas_top).offset(8); - make.bottom.equalTo(self.bottomBar.mas_bottom).offset(-8); + make.top.equalTo(self.bottomBar.mas_top).offset(4); + make.bottom.equalTo(self.bottomBar.mas_bottom).offset(-4); }]; [self.tabStackView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -196,6 +196,23 @@ [self applyTheme:[KBSkinManager shared].current]; } +- (void)layoutSubviews { + [super layoutSubviews]; + [self updateTabButtonCornerRadii]; +} + +- (void)updateTabButtonCornerRadii { + if (self.tabButtons.count == 0) { return; } + for (UIButton *btn in self.tabButtons) { + CGFloat radius = MIN(CGRectGetHeight(btn.bounds), CGRectGetWidth(btn.bounds)) / 2.0; + if (radius <= 0) { continue; } + btn.layer.cornerRadius = radius; + if (@available(iOS 13.0, *)) { + btn.layer.cornerCurve = kCACornerCurveContinuous; + } + } +} + - (void)registerNotifications { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onEmojiDataChanged) @@ -241,10 +258,13 @@ [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [btn addTarget:self action:@selector(onTabTapped:) forControlEvents:UIControlEventTouchUpInside]; btn.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 12); + btn.translatesAutoresizingMaskIntoConstraints = NO; +// [btn.heightAnchor constraintEqualTo:self.tabScrollView.heightAnchor].active = YES; [self.tabStackView addArrangedSubview:btn]; [buttons addObject:btn]; }]; self.tabButtons = buttons.copy; + [self setNeedsLayout]; } - (void)updateSelectionToIndex:(NSInteger)index { diff --git a/keyBoard.xcodeproj/project.pbxproj b/keyBoard.xcodeproj/project.pbxproj index 3dca934..5427f50 100644 --- a/keyBoard.xcodeproj/project.pbxproj +++ b/keyBoard.xcodeproj/project.pbxproj @@ -155,8 +155,6 @@ 04C6EACE2EAF87020089C901 /* CustomKeyboard.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 04C6EAC62EAF87020089C901 /* CustomKeyboard.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 04C6EAD82EAF870B0089C901 /* KeyboardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAD62EAF870B0089C901 /* KeyboardViewController.m */; }; 04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */; }; - 04FEDAA12EEDB00100123456 /* KBEmojiDataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */; }; - 04FEDAB32EEDB05000123456 /* KBEmojiPanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */; }; 04D1F6B22EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */; }; 04D1F6B32EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */; }; 04FC95672EB0546C007BD342 /* KBKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95652EB0546C007BD342 /* KBKey.m */; }; @@ -183,6 +181,8 @@ 04FC97092EB31B14007BD342 /* KBHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC97082EB31B14007BD342 /* KBHUD.m */; }; 04FC970E2EB334F8007BD342 /* UIImageView+KBWebImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC970B2EB334F8007BD342 /* UIImageView+KBWebImage.m */; }; 04FC970F2EB334F8007BD342 /* KBWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC970D2EB334F8007BD342 /* KBWebImageManager.m */; }; + 04FEDAA12EEDB00100123456 /* KBEmojiDataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */; }; + 04FEDAB32EEDB05000123456 /* KBEmojiPanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */; }; 471CAD3574798685B72ADD55 /* KBMyTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */; }; 49B63DBAEE9076C591E13D68 /* KBShopThemeTagModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E2A844CD2D8584596DBE6316 /* KBShopThemeTagModel.m */; }; 550CB2630FA4A7B4B9782EFA /* KBMyTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */; }; @@ -507,10 +507,6 @@ 04FC95752EB095DE007BD342 /* KBFunctionPasteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFunctionPasteView.m; sourceTree = ""; }; 04FC95772EB09BC8007BD342 /* KBKeyBoardMainView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyBoardMainView.h; sourceTree = ""; }; 04FC95782EB09BC8007BD342 /* KBKeyBoardMainView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyBoardMainView.m; sourceTree = ""; }; - 04FEDA9F2EEDB00100123456 /* KBEmojiDataProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiDataProvider.h; sourceTree = ""; }; - 04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiDataProvider.m; sourceTree = ""; }; - 04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiPanelView.h; sourceTree = ""; }; - 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiPanelView.m; sourceTree = ""; }; 04FC95B02EB0B2CC007BD342 /* KBSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSettingView.h; sourceTree = ""; }; 04FC95B12EB0B2CC007BD342 /* KBSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSettingView.m; sourceTree = ""; }; 04FC95C72EB1E4C9007BD342 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = ""; }; @@ -547,6 +543,10 @@ 04FC970C2EB334F8007BD342 /* KBWebImageManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBWebImageManager.h; sourceTree = ""; }; 04FC970D2EB334F8007BD342 /* KBWebImageManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBWebImageManager.m; sourceTree = ""; }; 04FC98012EB36AAB007BD342 /* KBConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBConfig.h; sourceTree = ""; }; + 04FEDA9F2EEDB00100123456 /* KBEmojiDataProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiDataProvider.h; sourceTree = ""; }; + 04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiDataProvider.m; sourceTree = ""; }; + 04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiPanelView.h; sourceTree = ""; }; + 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiPanelView.m; sourceTree = ""; }; 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMyTheme.m; sourceTree = ""; }; 2C1092FB2B452F95B15D4263 /* Pods_CustomKeyboard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CustomKeyboard.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 35E2B1C590E060D912A4E7F4 /* KBShopThemeTagModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBShopThemeTagModel.h; sourceTree = ""; }; @@ -938,6 +938,13 @@ path = VM; sourceTree = ""; }; + 0498BDF62EEFF585006CC1D5 /* EmojiView */ = { + isa = PBXGroup; + children = ( + ); + path = EmojiView; + sourceTree = ""; + }; 049FB2162EC20A6600FAB05D /* BMLongPressDragCellCollectionView */ = { isa = PBXGroup; children = ( @@ -1020,6 +1027,7 @@ 04C6EADA2EAF8C7B0089C901 /* View */ = { isa = PBXGroup; children = ( + 0498BDF62EEFF585006CC1D5 /* EmojiView */, 04C6EADB2EAF8CEB0089C901 /* KBToolBar.h */, 04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */, 04A9A67D2EB9E1690023B8F4 /* KBResponderUtils.h */, diff --git a/keyBoard/Class/Common/V/KBHUD.m b/keyBoard/Class/Common/V/KBHUD.m index b21f6b7..a462414 100644 --- a/keyBoard/Class/Common/V/KBHUD.m +++ b/keyBoard/Class/Common/V/KBHUD.m @@ -25,13 +25,12 @@ static __weak UIView *sContainerView = nil; // 缺省承载视图( if (NSThread.isMainThread) { blk(); } else { dispatch_async(dispatch_get_main_queue(), blk); } } -+ (MBProgressHUD *)ensureHUDWithMask:(KBHUDMaskType)mask tap:(BOOL)tap { - // 先尝试使用外部指定的容器视图(扩展环境推荐) +/// 解析当前 HUD 需要附着的宿主视图 ++ (UIView *)kb_resolvedHostView { UIView *hostView = sContainerView; #ifndef KB_APP_EXTENSION // App 内退回到 KeyWindow if (!hostView) { - // KB_KeyWindow 在 App 目标的 PrefixHeader 中定义;在扩展内不依赖它 UIWindow *win = nil; // 避免强依赖某个前缀:这里以运行时方式访问 UIApplication 以规避编译期的 App Extension 限制 Class uiAppClass = NSClassFromString(@"UIApplication"); @@ -51,7 +50,11 @@ static __weak UIView *sContainerView = nil; // 缺省承载视图( hostView = win; } #endif + return hostView; +} ++ (MBProgressHUD *)ensureHUDWithMask:(KBHUDMaskType)mask tap:(BOOL)tap { + UIView *hostView = [self kb_resolvedHostView]; if (!hostView) { return nil; } MBProgressHUD *hud = sHUD; @@ -119,8 +122,27 @@ static __weak UIView *sContainerView = nil; // 缺省承载视图( + (void)_showText:(NSString *)text icon:(nullable UIImage *)icon { [self onMain:^{ - MBProgressHUD *hud = [self ensureHUDWithMask:sMaskType tap:sDefaultTapToDismiss]; - if (!hud) { return; } + MBProgressHUD *loadingHUD = sHUD; + if (loadingHUD) { + [loadingHUD hideAnimated:YES]; + } + sHUD = nil; + + UIView *hostView = [self kb_resolvedHostView]; + if (!hostView) { return; } + + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:hostView animated:YES]; + hud.removeFromSuperViewOnHide = YES; + hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor; + hud.bezelView.layer.cornerRadius = 12.0; + hud.bezelView.color = [UIColor colorWithWhite:0 alpha:0.8]; + hud.contentColor = UIColor.whiteColor; + hud.margin = 16; + hud.label.numberOfLines = 0; + hud.detailsLabel.numberOfLines = 0; + [self applyMaskType:sMaskType hud:hud]; + [self applyTapToDismiss:sDefaultTapToDismiss hud:hud]; + hud.mode = icon ? MBProgressHUDModeCustomView : MBProgressHUDModeText; hud.label.text = text ?: @""; hud.detailsLabel.text = nil; diff --git a/keyBoard/Class/Guard/V/KBGuideTopCell.m b/keyBoard/Class/Guard/V/KBGuideTopCell.m index a9dd428..fb7f7a1 100644 --- a/keyBoard/Class/Guard/V/KBGuideTopCell.m +++ b/keyBoard/Class/Guard/V/KBGuideTopCell.m @@ -14,17 +14,17 @@ // 卡片标题/正文 @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UILabel *descLabel; -@property (nonatomic, strong) UIView *line1; -@property (nonatomic, strong) UILabel *q1Label; -@property (nonatomic, strong) UIView *line2; -@property (nonatomic, strong) UILabel *q2Label; +@property (nonatomic, strong) UIStackView *buttonStack; +@property (nonatomic, strong) UIButton *q1Button; +@property (nonatomic, strong) UIButton *q2Button; @end @implementation KBGuideTopCell - (void)setupUI { - self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0]; + self.backgroundColor = [UIColor clearColor]; + self.contentView.backgroundColor = [UIColor clearColor]; // 头像 [self.contentView addSubview:self.avatarView]; @@ -55,33 +55,23 @@ make.left.right.equalTo(self.titleLabel); }]; - // 分隔、两条示例问题 - [self.cardView addSubview:self.line1]; - [self.cardView addSubview:self.q1Label]; - [self.cardView addSubview:self.line2]; - [self.cardView addSubview:self.q2Label]; - - [self.line1 mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.descLabel.mas_bottom).offset(10); - make.left.right.equalTo(self.cardView); - make.height.mas_equalTo(KB_ONE_PIXEL); + // 示例按钮区域 + [self.cardView addSubview:self.buttonStack]; + [self.buttonStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.descLabel.mas_bottom).offset(20); + make.left.equalTo(self.cardView).offset(12); + make.right.equalTo(self.cardView).offset(-12); + make.bottom.equalTo(self.cardView).offset(-16); }]; - [self.q1Label mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.line1.mas_bottom).offset(10); - make.left.right.equalTo(self.titleLabel); - }]; + [self.buttonStack addArrangedSubview:self.q1Button]; + [self.buttonStack addArrangedSubview:self.q2Button]; - [self.line2 mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.q1Label.mas_bottom).offset(10); - make.left.right.equalTo(self.cardView); - make.height.mas_equalTo(KB_ONE_PIXEL); + [self.q1Button mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); }]; - - [self.q2Label mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.line2.mas_bottom).offset(10); - make.left.right.equalTo(self.titleLabel); - make.bottom.equalTo(self.cardView).offset(-14); + [self.q2Button mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(46); }]; } @@ -101,8 +91,12 @@ if (!_cardView) { _cardView = [UIView new]; _cardView.backgroundColor = [UIColor whiteColor]; - _cardView.layer.cornerRadius = 18; - _cardView.layer.masksToBounds = YES; + _cardView.layer.cornerRadius = 20; + _cardView.layer.masksToBounds = NO; + _cardView.layer.shadowColor = [UIColor colorWithRed:0.42 green:0.54 blue:0.83 alpha:0.35].CGColor; + _cardView.layer.shadowOpacity = 0.5; + _cardView.layer.shadowOffset = CGSizeMake(0, 6); + _cardView.layer.shadowRadius = 14; } return _cardView; } @@ -111,9 +105,9 @@ if (!_titleLabel) { _titleLabel = [UILabel new]; _titleLabel.numberOfLines = 0; - _titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; - _titleLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.0]; - _titleLabel.text = KBLocalized(@"👋 Welcome to Key of Love Keyboard"); + _titleLabel.font = [KBFont regular:10]; + _titleLabel.textColor = [UIColor colorWithHex:0x929292]; + _titleLabel.text = KBLocalized(@"Welcome To Use The [key Of Love] Keyboard"); } return _titleLabel; } @@ -122,42 +116,60 @@ if (!_descLabel) { _descLabel = [UILabel new]; _descLabel.numberOfLines = 0; - _descLabel.font = [UIFont systemFontOfSize:14]; - _descLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.0]; - _descLabel.text = KBLocalized(@"Tap any conversation to paste, then try any reply style~"); + _descLabel.font = [KBFont regular:10]; + _descLabel.textColor = [UIColor colorWithHex:0x929292]; + NSString *desc = KBLocalized(@"Click \"copy Any Conversation\", \"paste\"\nAnd Try Replying Using The Keyboard\n[persona] Method"); + NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; + style.lineSpacing = 4; + _descLabel.attributedText = [[NSAttributedString alloc] initWithString:desc attributes:@{ + NSParagraphStyleAttributeName : style + }]; } return _descLabel; } -- (UIView *)line1 { if (!_line1) { _line1 = [UIView new]; _line1.backgroundColor = [UIColor colorWithWhite:0.92 alpha:1.0]; } return _line1; } -- (UIView *)line2 { if (!_line2) { _line2 = [UIView new]; _line2.backgroundColor = [UIColor colorWithWhite:0.92 alpha:1.0]; } return _line2; } - -- (UILabel *)q1Label { - if (!_q1Label) { - _q1Label = [UILabel new]; - _q1Label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; - _q1Label.textColor = [UIColor blackColor]; - _q1Label.text = KBLocalized(@"What are you doing?"); - // 支持点击复制 - _q1Label.userInteractionEnabled = YES; - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(kb_onTapQ1)]; - [_q1Label addGestureRecognizer:tap]; +- (UIStackView *)buttonStack { + if (!_buttonStack) { + _buttonStack = [[UIStackView alloc] init]; + _buttonStack.axis = UILayoutConstraintAxisVertical; + _buttonStack.distribution = UIStackViewDistributionFill; + _buttonStack.spacing = 10; } - return _q1Label; + return _buttonStack; } -- (UILabel *)q2Label { - if (!_q2Label) { - _q2Label = [UILabel new]; - _q2Label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; - _q2Label.textColor = [UIColor blackColor]; - _q2Label.text = KBLocalized(@"I'm going to take a shower."); - // 支持点击复制 - _q2Label.userInteractionEnabled = YES; - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(kb_onTapQ2)]; - [_q2Label addGestureRecognizer:tap]; +- (UIButton *)q1Button { + if (!_q1Button) { + _q1Button = [self kb_makeActionButton]; + [_q1Button setTitle:KBLocalized(@"I Miss You") forState:UIControlStateNormal]; + [_q1Button addTarget:self action:@selector(kb_onTapQ1) forControlEvents:UIControlEventTouchUpInside]; } - return _q2Label; + return _q1Button; +} + +- (UIButton *)q2Button { + if (!_q2Button) { + _q2Button = [self kb_makeActionButton]; + [_q2Button setTitle:KBLocalized(@"I'm Going To Take A Bath") forState:UIControlStateNormal]; + [_q2Button addTarget:self action:@selector(kb_onTapQ2) forControlEvents:UIControlEventTouchUpInside]; + } + return _q2Button; +} + +- (UIButton *)kb_makeActionButton { + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; + btn.backgroundColor = [UIColor whiteColor]; + btn.layer.cornerRadius = 4; + btn.backgroundColor = [UIColor colorWithHex:0xF3F3F3]; +// btn.layer.borderWidth = 1; +// btn.layer.borderColor = [UIColor colorWithRed:0.82 green:0.86 blue:0.99 alpha:1].CGColor; + btn.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; + [btn setTitleColor:[UIColor colorWithHex:0x1B1F1A] forState:UIControlStateNormal]; + btn.titleLabel.numberOfLines = 0; + btn.titleLabel.textAlignment = NSTextAlignmentCenter; + btn.contentEdgeInsets = UIEdgeInsetsMake(10, 16, 10, 16); + btn.adjustsImageWhenHighlighted = NO; + return btn; } /// 复制统一处理 @@ -169,12 +181,12 @@ /// 点击第一条示例文案 - (void)kb_onTapQ1 { - [self kb_copyTextToPasteboard:self.q1Label.text]; + [self kb_copyTextToPasteboard:[self.q1Button titleForState:UIControlStateNormal]]; } /// 点击第二条示例文案 - (void)kb_onTapQ2 { - [self kb_copyTextToPasteboard:self.q2Label.text]; + [self kb_copyTextToPasteboard:[self.q2Button titleForState:UIControlStateNormal]]; } @end diff --git a/keyBoard/Class/Guard/VC/KBGuideVC.m b/keyBoard/Class/Guard/VC/KBGuideVC.m index 1b4b027..2210484 100644 --- a/keyBoard/Class/Guard/VC/KBGuideVC.m +++ b/keyBoard/Class/Guard/VC/KBGuideVC.m @@ -38,6 +38,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) { /// 最近一次已知的键盘高度(用于初次展示蒙层时的 GIF 位置计算) @property (nonatomic, assign) CGFloat kb_currentKeyboardHeight; +@property (nonatomic, strong) UIImageView *bgImageView; // 全屏背景图 @end @@ -45,7 +46,15 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) { - (void)viewDidLoad { [super viewDidLoad]; - self.view.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0]; +// self.view.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0]; + self.view.backgroundColor = UIColor.clearColor; + self.kb_navView.backgroundColor = [UIColor clearColor]; + self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my_bg_icon"]]; + self.bgImageView.contentMode = UIViewContentModeScaleAspectFill; + [self.view insertSubview:self.bgImageView belowSubview:self.kb_navView]; + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.view); + }]; [self.view addSubview:self.tableView]; [self.view addSubview:self.inputBar]; @@ -421,7 +430,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) { _tableView.delegate = self; _tableView.dataSource = self; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // 无分割线 - _tableView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0]; + _tableView.backgroundColor = [UIColor clearColor]; _tableView.rowHeight = UITableViewAutomaticDimension; _tableView.estimatedRowHeight = 120; // 开启自适应高度 _tableView.contentInset = UIEdgeInsetsMake(0, 0, 52 + KB_SafeAreaBottom(), 0);