1
This commit is contained in:
@@ -106,7 +106,7 @@
|
|||||||
[topBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
[topBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.equalTo(self);
|
make.left.right.equalTo(self);
|
||||||
make.top.equalTo(self.mas_top).offset(4);
|
make.top.equalTo(self.mas_top).offset(4);
|
||||||
make.height.mas_equalTo(44);
|
make.height.mas_equalTo(40);
|
||||||
}];
|
}];
|
||||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.equalTo(topBar.mas_left).offset(12);
|
make.left.equalTo(topBar.mas_left).offset(12);
|
||||||
@@ -151,14 +151,14 @@
|
|||||||
self.tabStackView = [[UIStackView alloc] init];
|
self.tabStackView = [[UIStackView alloc] init];
|
||||||
self.tabStackView.axis = UILayoutConstraintAxisHorizontal;
|
self.tabStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||||
self.tabStackView.spacing = 8;
|
self.tabStackView.spacing = 8;
|
||||||
self.tabStackView.alignment = UIStackViewAlignmentCenter;
|
self.tabStackView.alignment = UIStackViewAlignmentFill;
|
||||||
[self.tabScrollView addSubview:self.tabStackView];
|
[self.tabScrollView addSubview:self.tabStackView];
|
||||||
|
|
||||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.equalTo(self.mas_left).offset(12);
|
make.left.equalTo(self.mas_left).offset(12);
|
||||||
make.right.equalTo(self.mas_right).offset(-12);
|
make.right.equalTo(self.mas_right).offset(-12);
|
||||||
make.top.equalTo(topBar.mas_bottom).offset(8);
|
make.top.equalTo(topBar.mas_bottom).offset(0);
|
||||||
make.bottom.equalTo(self.bottomBar.mas_top).offset(-8);
|
make.bottom.equalTo(self.bottomBar.mas_top).offset(0);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
@@ -177,8 +177,8 @@
|
|||||||
make.left.equalTo(self.bottomBar.mas_left).offset(12);
|
make.left.equalTo(self.bottomBar.mas_left).offset(12);
|
||||||
// make.right.equalTo(self.searchButton.mas_left).offset(-12);
|
// make.right.equalTo(self.searchButton.mas_left).offset(-12);
|
||||||
make.right.equalTo(self.bottomBar.mas_right).offset(-12);
|
make.right.equalTo(self.bottomBar.mas_right).offset(-12);
|
||||||
make.top.equalTo(self.bottomBar.mas_top).offset(8);
|
make.top.equalTo(self.bottomBar.mas_top).offset(4);
|
||||||
make.bottom.equalTo(self.bottomBar.mas_bottom).offset(-8);
|
make.bottom.equalTo(self.bottomBar.mas_bottom).offset(-4);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.tabStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.tabStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
@@ -196,6 +196,23 @@
|
|||||||
[self applyTheme:[KBSkinManager shared].current];
|
[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 {
|
- (void)registerNotifications {
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(onEmojiDataChanged)
|
selector:@selector(onEmojiDataChanged)
|
||||||
@@ -241,10 +258,13 @@
|
|||||||
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||||
[btn addTarget:self action:@selector(onTabTapped:) forControlEvents:UIControlEventTouchUpInside];
|
[btn addTarget:self action:@selector(onTabTapped:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
btn.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 12);
|
btn.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 12);
|
||||||
|
btn.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
|
// [btn.heightAnchor constraintEqualTo:self.tabScrollView.heightAnchor].active = YES;
|
||||||
[self.tabStackView addArrangedSubview:btn];
|
[self.tabStackView addArrangedSubview:btn];
|
||||||
[buttons addObject:btn];
|
[buttons addObject:btn];
|
||||||
}];
|
}];
|
||||||
self.tabButtons = buttons.copy;
|
self.tabButtons = buttons.copy;
|
||||||
|
[self setNeedsLayout];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateSelectionToIndex:(NSInteger)index {
|
- (void)updateSelectionToIndex:(NSInteger)index {
|
||||||
|
|||||||
@@ -155,8 +155,6 @@
|
|||||||
04C6EACE2EAF87020089C901 /* CustomKeyboard.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 04C6EAC62EAF87020089C901 /* CustomKeyboard.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
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 */; };
|
04C6EAD82EAF870B0089C901 /* KeyboardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAD62EAF870B0089C901 /* KeyboardViewController.m */; };
|
||||||
04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EADC2EAF8CEB0089C901 /* KBToolBar.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 */; };
|
04D1F6B22EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */; };
|
||||||
04D1F6B32EDFF10A00B12345 /* 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 */; };
|
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 */; };
|
04FC97092EB31B14007BD342 /* KBHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC97082EB31B14007BD342 /* KBHUD.m */; };
|
||||||
04FC970E2EB334F8007BD342 /* UIImageView+KBWebImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC970B2EB334F8007BD342 /* UIImageView+KBWebImage.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 */; };
|
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 */; };
|
471CAD3574798685B72ADD55 /* KBMyTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */; };
|
||||||
49B63DBAEE9076C591E13D68 /* KBShopThemeTagModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E2A844CD2D8584596DBE6316 /* KBShopThemeTagModel.m */; };
|
49B63DBAEE9076C591E13D68 /* KBShopThemeTagModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E2A844CD2D8584596DBE6316 /* KBShopThemeTagModel.m */; };
|
||||||
550CB2630FA4A7B4B9782EFA /* KBMyTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.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 = "<group>"; };
|
04FC95752EB095DE007BD342 /* KBFunctionPasteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFunctionPasteView.m; sourceTree = "<group>"; };
|
||||||
04FC95772EB09BC8007BD342 /* KBKeyBoardMainView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyBoardMainView.h; sourceTree = "<group>"; };
|
04FC95772EB09BC8007BD342 /* KBKeyBoardMainView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyBoardMainView.h; sourceTree = "<group>"; };
|
||||||
04FC95782EB09BC8007BD342 /* KBKeyBoardMainView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyBoardMainView.m; sourceTree = "<group>"; };
|
04FC95782EB09BC8007BD342 /* KBKeyBoardMainView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyBoardMainView.m; sourceTree = "<group>"; };
|
||||||
04FEDA9F2EEDB00100123456 /* KBEmojiDataProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiDataProvider.h; sourceTree = "<group>"; };
|
|
||||||
04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiDataProvider.m; sourceTree = "<group>"; };
|
|
||||||
04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiPanelView.h; sourceTree = "<group>"; };
|
|
||||||
04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiPanelView.m; sourceTree = "<group>"; };
|
|
||||||
04FC95B02EB0B2CC007BD342 /* KBSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSettingView.h; sourceTree = "<group>"; };
|
04FC95B02EB0B2CC007BD342 /* KBSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSettingView.h; sourceTree = "<group>"; };
|
||||||
04FC95B12EB0B2CC007BD342 /* KBSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSettingView.m; sourceTree = "<group>"; };
|
04FC95B12EB0B2CC007BD342 /* KBSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSettingView.m; sourceTree = "<group>"; };
|
||||||
04FC95C72EB1E4C9007BD342 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = "<group>"; };
|
04FC95C72EB1E4C9007BD342 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = "<group>"; };
|
||||||
@@ -547,6 +543,10 @@
|
|||||||
04FC970C2EB334F8007BD342 /* KBWebImageManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBWebImageManager.h; sourceTree = "<group>"; };
|
04FC970C2EB334F8007BD342 /* KBWebImageManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBWebImageManager.h; sourceTree = "<group>"; };
|
||||||
04FC970D2EB334F8007BD342 /* KBWebImageManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBWebImageManager.m; sourceTree = "<group>"; };
|
04FC970D2EB334F8007BD342 /* KBWebImageManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBWebImageManager.m; sourceTree = "<group>"; };
|
||||||
04FC98012EB36AAB007BD342 /* KBConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBConfig.h; sourceTree = "<group>"; };
|
04FC98012EB36AAB007BD342 /* KBConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBConfig.h; sourceTree = "<group>"; };
|
||||||
|
04FEDA9F2EEDB00100123456 /* KBEmojiDataProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiDataProvider.h; sourceTree = "<group>"; };
|
||||||
|
04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiDataProvider.m; sourceTree = "<group>"; };
|
||||||
|
04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiPanelView.h; sourceTree = "<group>"; };
|
||||||
|
04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiPanelView.m; sourceTree = "<group>"; };
|
||||||
180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMyTheme.m; sourceTree = "<group>"; };
|
180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMyTheme.m; sourceTree = "<group>"; };
|
||||||
2C1092FB2B452F95B15D4263 /* Pods_CustomKeyboard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CustomKeyboard.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
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 = "<group>"; };
|
35E2B1C590E060D912A4E7F4 /* KBShopThemeTagModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBShopThemeTagModel.h; sourceTree = "<group>"; };
|
||||||
@@ -938,6 +938,13 @@
|
|||||||
path = VM;
|
path = VM;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
0498BDF62EEFF585006CC1D5 /* EmojiView */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
);
|
||||||
|
path = EmojiView;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
049FB2162EC20A6600FAB05D /* BMLongPressDragCellCollectionView */ = {
|
049FB2162EC20A6600FAB05D /* BMLongPressDragCellCollectionView */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -1020,6 +1027,7 @@
|
|||||||
04C6EADA2EAF8C7B0089C901 /* View */ = {
|
04C6EADA2EAF8C7B0089C901 /* View */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
0498BDF62EEFF585006CC1D5 /* EmojiView */,
|
||||||
04C6EADB2EAF8CEB0089C901 /* KBToolBar.h */,
|
04C6EADB2EAF8CEB0089C901 /* KBToolBar.h */,
|
||||||
04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */,
|
04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */,
|
||||||
04A9A67D2EB9E1690023B8F4 /* KBResponderUtils.h */,
|
04A9A67D2EB9E1690023B8F4 /* KBResponderUtils.h */,
|
||||||
|
|||||||
@@ -25,13 +25,12 @@ static __weak UIView *sContainerView = nil; // 缺省承载视图(
|
|||||||
if (NSThread.isMainThread) { blk(); } else { dispatch_async(dispatch_get_main_queue(), blk); }
|
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;
|
UIView *hostView = sContainerView;
|
||||||
#ifndef KB_APP_EXTENSION
|
#ifndef KB_APP_EXTENSION
|
||||||
// App 内退回到 KeyWindow
|
// App 内退回到 KeyWindow
|
||||||
if (!hostView) {
|
if (!hostView) {
|
||||||
// KB_KeyWindow 在 App 目标的 PrefixHeader 中定义;在扩展内不依赖它
|
|
||||||
UIWindow *win = nil;
|
UIWindow *win = nil;
|
||||||
// 避免强依赖某个前缀:这里以运行时方式访问 UIApplication 以规避编译期的 App Extension 限制
|
// 避免强依赖某个前缀:这里以运行时方式访问 UIApplication 以规避编译期的 App Extension 限制
|
||||||
Class uiAppClass = NSClassFromString(@"UIApplication");
|
Class uiAppClass = NSClassFromString(@"UIApplication");
|
||||||
@@ -51,7 +50,11 @@ static __weak UIView *sContainerView = nil; // 缺省承载视图(
|
|||||||
hostView = win;
|
hostView = win;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return hostView;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (MBProgressHUD *)ensureHUDWithMask:(KBHUDMaskType)mask tap:(BOOL)tap {
|
||||||
|
UIView *hostView = [self kb_resolvedHostView];
|
||||||
if (!hostView) { return nil; }
|
if (!hostView) { return nil; }
|
||||||
|
|
||||||
MBProgressHUD *hud = sHUD;
|
MBProgressHUD *hud = sHUD;
|
||||||
@@ -119,8 +122,27 @@ static __weak UIView *sContainerView = nil; // 缺省承载视图(
|
|||||||
|
|
||||||
+ (void)_showText:(NSString *)text icon:(nullable UIImage *)icon {
|
+ (void)_showText:(NSString *)text icon:(nullable UIImage *)icon {
|
||||||
[self onMain:^{
|
[self onMain:^{
|
||||||
MBProgressHUD *hud = [self ensureHUDWithMask:sMaskType tap:sDefaultTapToDismiss];
|
MBProgressHUD *loadingHUD = sHUD;
|
||||||
if (!hud) { return; }
|
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.mode = icon ? MBProgressHUDModeCustomView : MBProgressHUDModeText;
|
||||||
hud.label.text = text ?: @"";
|
hud.label.text = text ?: @"";
|
||||||
hud.detailsLabel.text = nil;
|
hud.detailsLabel.text = nil;
|
||||||
|
|||||||
@@ -14,17 +14,17 @@
|
|||||||
// 卡片标题/正文
|
// 卡片标题/正文
|
||||||
@property (nonatomic, strong) UILabel *titleLabel;
|
@property (nonatomic, strong) UILabel *titleLabel;
|
||||||
@property (nonatomic, strong) UILabel *descLabel;
|
@property (nonatomic, strong) UILabel *descLabel;
|
||||||
@property (nonatomic, strong) UIView *line1;
|
@property (nonatomic, strong) UIStackView *buttonStack;
|
||||||
@property (nonatomic, strong) UILabel *q1Label;
|
@property (nonatomic, strong) UIButton *q1Button;
|
||||||
@property (nonatomic, strong) UIView *line2;
|
@property (nonatomic, strong) UIButton *q2Button;
|
||||||
@property (nonatomic, strong) UILabel *q2Label;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation KBGuideTopCell
|
@implementation KBGuideTopCell
|
||||||
|
|
||||||
- (void)setupUI {
|
- (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];
|
[self.contentView addSubview:self.avatarView];
|
||||||
@@ -55,33 +55,23 @@
|
|||||||
make.left.right.equalTo(self.titleLabel);
|
make.left.right.equalTo(self.titleLabel);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// 分隔、两条示例问题
|
// 示例按钮区域
|
||||||
[self.cardView addSubview:self.line1];
|
[self.cardView addSubview:self.buttonStack];
|
||||||
[self.cardView addSubview:self.q1Label];
|
[self.buttonStack mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
[self.cardView addSubview:self.line2];
|
make.top.equalTo(self.descLabel.mas_bottom).offset(20);
|
||||||
[self.cardView addSubview:self.q2Label];
|
make.left.equalTo(self.cardView).offset(12);
|
||||||
|
make.right.equalTo(self.cardView).offset(-12);
|
||||||
[self.line1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.bottom.equalTo(self.cardView).offset(-16);
|
||||||
make.top.equalTo(self.descLabel.mas_bottom).offset(10);
|
|
||||||
make.left.right.equalTo(self.cardView);
|
|
||||||
make.height.mas_equalTo(KB_ONE_PIXEL);
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.q1Label mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.buttonStack addArrangedSubview:self.q1Button];
|
||||||
make.top.equalTo(self.line1.mas_bottom).offset(10);
|
[self.buttonStack addArrangedSubview:self.q2Button];
|
||||||
make.left.right.equalTo(self.titleLabel);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self.line2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.q1Button mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.equalTo(self.q1Label.mas_bottom).offset(10);
|
make.height.mas_equalTo(46);
|
||||||
make.left.right.equalTo(self.cardView);
|
|
||||||
make.height.mas_equalTo(KB_ONE_PIXEL);
|
|
||||||
}];
|
}];
|
||||||
|
[self.q2Button mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
[self.q2Label mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.height.mas_equalTo(46);
|
||||||
make.top.equalTo(self.line2.mas_bottom).offset(10);
|
|
||||||
make.left.right.equalTo(self.titleLabel);
|
|
||||||
make.bottom.equalTo(self.cardView).offset(-14);
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +91,12 @@
|
|||||||
if (!_cardView) {
|
if (!_cardView) {
|
||||||
_cardView = [UIView new];
|
_cardView = [UIView new];
|
||||||
_cardView.backgroundColor = [UIColor whiteColor];
|
_cardView.backgroundColor = [UIColor whiteColor];
|
||||||
_cardView.layer.cornerRadius = 18;
|
_cardView.layer.cornerRadius = 20;
|
||||||
_cardView.layer.masksToBounds = YES;
|
_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;
|
return _cardView;
|
||||||
}
|
}
|
||||||
@@ -111,9 +105,9 @@
|
|||||||
if (!_titleLabel) {
|
if (!_titleLabel) {
|
||||||
_titleLabel = [UILabel new];
|
_titleLabel = [UILabel new];
|
||||||
_titleLabel.numberOfLines = 0;
|
_titleLabel.numberOfLines = 0;
|
||||||
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
_titleLabel.font = [KBFont regular:10];
|
||||||
_titleLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.0];
|
_titleLabel.textColor = [UIColor colorWithHex:0x929292];
|
||||||
_titleLabel.text = KBLocalized(@"👋 Welcome to Key of Love Keyboard");
|
_titleLabel.text = KBLocalized(@"Welcome To Use The [key Of Love] Keyboard");
|
||||||
}
|
}
|
||||||
return _titleLabel;
|
return _titleLabel;
|
||||||
}
|
}
|
||||||
@@ -122,42 +116,60 @@
|
|||||||
if (!_descLabel) {
|
if (!_descLabel) {
|
||||||
_descLabel = [UILabel new];
|
_descLabel = [UILabel new];
|
||||||
_descLabel.numberOfLines = 0;
|
_descLabel.numberOfLines = 0;
|
||||||
_descLabel.font = [UIFont systemFontOfSize:14];
|
_descLabel.font = [KBFont regular:10];
|
||||||
_descLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.0];
|
_descLabel.textColor = [UIColor colorWithHex:0x929292];
|
||||||
_descLabel.text = KBLocalized(@"Tap any conversation to paste, then try any reply style~");
|
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;
|
return _descLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIView *)line1 { if (!_line1) { _line1 = [UIView new]; _line1.backgroundColor = [UIColor colorWithWhite:0.92 alpha:1.0]; } return _line1; }
|
- (UIStackView *)buttonStack {
|
||||||
- (UIView *)line2 { if (!_line2) { _line2 = [UIView new]; _line2.backgroundColor = [UIColor colorWithWhite:0.92 alpha:1.0]; } return _line2; }
|
if (!_buttonStack) {
|
||||||
|
_buttonStack = [[UIStackView alloc] init];
|
||||||
- (UILabel *)q1Label {
|
_buttonStack.axis = UILayoutConstraintAxisVertical;
|
||||||
if (!_q1Label) {
|
_buttonStack.distribution = UIStackViewDistributionFill;
|
||||||
_q1Label = [UILabel new];
|
_buttonStack.spacing = 10;
|
||||||
_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];
|
|
||||||
}
|
}
|
||||||
return _q1Label;
|
return _buttonStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UILabel *)q2Label {
|
- (UIButton *)q1Button {
|
||||||
if (!_q2Label) {
|
if (!_q1Button) {
|
||||||
_q2Label = [UILabel new];
|
_q1Button = [self kb_makeActionButton];
|
||||||
_q2Label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
[_q1Button setTitle:KBLocalized(@"I Miss You") forState:UIControlStateNormal];
|
||||||
_q2Label.textColor = [UIColor blackColor];
|
[_q1Button addTarget:self action:@selector(kb_onTapQ1) forControlEvents:UIControlEventTouchUpInside];
|
||||||
_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];
|
|
||||||
}
|
}
|
||||||
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 {
|
- (void)kb_onTapQ1 {
|
||||||
[self kb_copyTextToPasteboard:self.q1Label.text];
|
[self kb_copyTextToPasteboard:[self.q1Button titleForState:UIControlStateNormal]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 点击第二条示例文案
|
/// 点击第二条示例文案
|
||||||
- (void)kb_onTapQ2 {
|
- (void)kb_onTapQ2 {
|
||||||
[self kb_copyTextToPasteboard:self.q2Label.text];
|
[self kb_copyTextToPasteboard:[self.q2Button titleForState:UIControlStateNormal]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
|||||||
|
|
||||||
/// 最近一次已知的键盘高度(用于初次展示蒙层时的 GIF 位置计算)
|
/// 最近一次已知的键盘高度(用于初次展示蒙层时的 GIF 位置计算)
|
||||||
@property (nonatomic, assign) CGFloat kb_currentKeyboardHeight;
|
@property (nonatomic, assign) CGFloat kb_currentKeyboardHeight;
|
||||||
|
@property (nonatomic, strong) UIImageView *bgImageView; // 全屏背景图
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -45,7 +46,15 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
|||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super 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.tableView];
|
||||||
[self.view addSubview:self.inputBar];
|
[self.view addSubview:self.inputBar];
|
||||||
@@ -421,7 +430,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
|||||||
_tableView.delegate = self;
|
_tableView.delegate = self;
|
||||||
_tableView.dataSource = self;
|
_tableView.dataSource = self;
|
||||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // 无分割线
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // 无分割线
|
||||||
_tableView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
|
_tableView.backgroundColor = [UIColor clearColor];
|
||||||
_tableView.rowHeight = UITableViewAutomaticDimension;
|
_tableView.rowHeight = UITableViewAutomaticDimension;
|
||||||
_tableView.estimatedRowHeight = 120; // 开启自适应高度
|
_tableView.estimatedRowHeight = 120; // 开启自适应高度
|
||||||
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 52 + KB_SafeAreaBottom(), 0);
|
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 52 + KB_SafeAreaBottom(), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user