修改暗黑模式功能UI

This commit is contained in:
2026-01-09 19:35:36 +08:00
parent 1b6724f043
commit 21fcbe3665
8 changed files with 1113 additions and 760 deletions

View File

@@ -4,15 +4,79 @@
"idiom" : "universal", "idiom" : "universal",
"scale" : "1x" "scale" : "1x"
}, },
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{ {
"filename" : "kb_del_icon@2x.png", "filename" : "kb_del_icon@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"filename" : "kb_del_icon@2x 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "切图 256@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{ {
"filename" : "kb_del_icon@3x.png", "filename" : "kb_del_icon@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"filename" : "kb_del_icon@3x 1.png",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "切图 256@3x.png",
"idiom" : "universal",
"scale" : "3x"
} }
], ],
"info" : { "info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -6,118 +6,125 @@
// //
#import "KBFunctionTagCell.h" #import "KBFunctionTagCell.h"
#import "KBFunctionView.h"
#import "Masonry.h" #import "Masonry.h"
@interface KBFunctionTagCell () @interface KBFunctionTagCell ()
@property (nonatomic, strong) UILabel *emojiLabel; @property(nonatomic, strong) UILabel *emojiLabel;
@property (nonatomic, strong) UILabel *titleLabelInternal; @property(nonatomic, strong) UILabel *titleLabelInternal;
@property (nonatomic, strong) UIActivityIndicatorView *loadingView; @property(nonatomic, strong) UIActivityIndicatorView *loadingView;
@end @end
@implementation KBFunctionTagCell @implementation KBFunctionTagCell
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
self.contentView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9]; self.contentView.backgroundColor = [KBFunctionView kb_cellBackgroundColor];
self.contentView.layer.cornerRadius = 12; self.contentView.layer.cornerRadius = 12;
self.contentView.layer.masksToBounds = YES; self.contentView.layer.masksToBounds = YES;
// //
[self.contentView addSubview:self.loadingView]; [self.contentView addSubview:self.loadingView];
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) { [self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self.contentView); make.center.equalTo(self.contentView);
make.width.height.mas_equalTo(16); make.width.height.mas_equalTo(16);
}]; }];
// icon + title // icon + title
UIView *centerContainer = [[UIView alloc] init]; UIView *centerContainer = [[UIView alloc] init];
centerContainer.backgroundColor = [UIColor clearColor]; centerContainer.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:centerContainer]; [self.contentView addSubview:centerContainer];
[centerContainer mas_makeConstraints:^(MASConstraintMaker *make) { [centerContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView.mas_centerX); make.centerX.equalTo(self.contentView.mas_centerX);
make.centerY.equalTo(self.contentView.mas_centerY); make.centerY.equalTo(self.contentView.mas_centerY);
make.left.greaterThanOrEqualTo(self.contentView.mas_left).offset(6); make.left.greaterThanOrEqualTo(self.contentView.mas_left).offset(6);
make.right.lessThanOrEqualTo(self.contentView).offset(-6); make.right.lessThanOrEqualTo(self.contentView).offset(-6);
}]; }];
[centerContainer addSubview:self.emojiLabel]; [centerContainer addSubview:self.emojiLabel];
[centerContainer addSubview:self.titleLabelInternal]; [centerContainer addSubview:self.titleLabelInternal];
[self.emojiLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.emojiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(centerContainer.mas_left); make.left.equalTo(centerContainer.mas_left);
make.centerY.equalTo(centerContainer.mas_centerY); make.centerY.equalTo(centerContainer.mas_centerY);
// emoji // emoji
make.width.height.mas_equalTo(24); make.width.height.mas_equalTo(24);
}]; }];
[self.titleLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.emojiLabel.mas_right).offset(3); make.left.equalTo(self.emojiLabel.mas_right).offset(3);
make.top.equalTo(centerContainer.mas_top); make.top.equalTo(centerContainer.mas_top);
make.bottom.equalTo(centerContainer.mas_bottom); make.bottom.equalTo(centerContainer.mas_bottom);
make.right.equalTo(centerContainer.mas_right); make.right.equalTo(centerContainer.mas_right);
}]; }];
} }
return self; return self;
} }
- (void)setItemModel:(KBTagItemModel *)itemModel{ - (void)setItemModel:(KBTagItemModel *)itemModel {
_itemModel = itemModel; _itemModel = itemModel;
self.emojiLabel.text = itemModel.emoji; self.emojiLabel.text = itemModel.emoji;
self.titleLabelInternal.text = itemModel.characterName; self.titleLabelInternal.text = itemModel.characterName;
} }
#pragma mark - Lazy #pragma mark - Lazy
- (UILabel *)emojiLabel { - (UILabel *)emojiLabel {
if (!_emojiLabel) { if (!_emojiLabel) {
_emojiLabel = [[UILabel alloc] init]; _emojiLabel = [[UILabel alloc] init];
_emojiLabel.textAlignment = NSTextAlignmentCenter; _emojiLabel.textAlignment = NSTextAlignmentCenter;
_emojiLabel.font = [KBFont medium:20]; _emojiLabel.font = [KBFont medium:20];
_emojiLabel.adjustsFontSizeToFitWidth = YES; _emojiLabel.adjustsFontSizeToFitWidth = YES;
}
} return _emojiLabel;
return _emojiLabel;
} }
- (UILabel *)titleLabelInternal { - (UILabel *)titleLabelInternal {
if (!_titleLabelInternal) { if (!_titleLabelInternal) {
_titleLabelInternal = [[UILabel alloc] init]; _titleLabelInternal = [[UILabel alloc] init];
_titleLabelInternal.font = [KBFont medium:10]; _titleLabelInternal.font = [KBFont medium:10];
_titleLabelInternal.textColor = [UIColor colorWithHex:0x1B1F1A]; _titleLabelInternal.textColor = [KBFunctionView kb_cellTextColor];
// //
_titleLabelInternal.numberOfLines = 2; _titleLabelInternal.numberOfLines = 2;
_titleLabelInternal.lineBreakMode = NSLineBreakByTruncatingTail; _titleLabelInternal.lineBreakMode = NSLineBreakByTruncatingTail;
} }
return _titleLabelInternal; return _titleLabelInternal;
} }
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) { return UIActivityIndicatorViewStyleMedium; } static UIActivityIndicatorViewStyle KBSpinnerStyle(void) {
return UIActivityIndicatorViewStyleMedium;
}
#else #else
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) { return UIActivityIndicatorViewStyleGray; } static UIActivityIndicatorViewStyle KBSpinnerStyle(void) {
return UIActivityIndicatorViewStyleGray;
}
#endif #endif
- (UIActivityIndicatorView *)loadingView { - (UIActivityIndicatorView *)loadingView {
if (!_loadingView) { if (!_loadingView) {
_loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:KBSpinnerStyle()]; _loadingView = [[UIActivityIndicatorView alloc]
_loadingView.hidesWhenStopped = YES; initWithActivityIndicatorStyle:KBSpinnerStyle()];
_loadingView.color = [UIColor grayColor]; _loadingView.hidesWhenStopped = YES;
_loadingView.hidden = YES; _loadingView.color = [UIColor grayColor];
} _loadingView.hidden = YES;
return _loadingView; }
return _loadingView;
} }
#pragma mark - Expose #pragma mark - Expose
- (UILabel *)titleLabel { return self.titleLabelInternal; } - (UILabel *)titleLabel {
return self.titleLabelInternal;
}
- (void)setLoading:(BOOL)loading { - (void)setLoading:(BOOL)loading {
if (loading) { if (loading) {
self.loadingView.hidden = NO; self.loadingView.hidden = NO;
[self.loadingView startAnimating]; [self.loadingView startAnimating];
} else { } else {
[self.loadingView stopAnimating]; [self.loadingView stopAnimating];
self.loadingView.hidden = YES; self.loadingView.hidden = YES;
} }
} }
@end @end

View File

@@ -6,13 +6,16 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@class KBFunctionBarView, KBFunctionPasteView,KBFunctionView; @class KBFunctionBarView, KBFunctionPasteView, KBFunctionView;
@protocol KBFunctionViewDelegate <NSObject> @protocol KBFunctionViewDelegate <NSObject>
@optional @optional
- (void)functionView:(KBFunctionView *_Nullable)functionView didTapToolActionAtIndex:(NSInteger)index; - (void)functionView:(KBFunctionView *_Nullable)functionView
- (void)functionView:(KBFunctionView *_Nullable)functionView didRightTapToolActionAtIndex:(NSInteger)index; didTapToolActionAtIndex:(NSInteger)index;
- (void)functionViewDidRequestSubscription:(KBFunctionView *_Nullable)functionView; - (void)functionView:(KBFunctionView *_Nullable)functionView
didRightTapToolActionAtIndex:(NSInteger)index;
- (void)functionViewDidRequestSubscription:
(KBFunctionView *_Nullable)functionView;
@end @end
@@ -21,24 +24,33 @@ NS_ASSUME_NONNULL_BEGIN
/// 整个功能面板视图顶部Bar + 粘贴区 + 标签列表 + 右侧操作按钮 /// 整个功能面板视图顶部Bar + 粘贴区 + 标签列表 + 右侧操作按钮
@interface KBFunctionView : UIView @interface KBFunctionView : UIView
@property (nonatomic, weak) id<KBFunctionViewDelegate> delegate; @property(nonatomic, weak) id<KBFunctionViewDelegate> delegate;
@property(nonatomic, strong, readonly)
@property (nonatomic, strong, readonly) UICollectionView *collectionView; // 话术分类/标签列表 UICollectionView *collectionView; // 话术分类/标签列表
@property (nonatomic, strong, readonly) NSArray<NSString *> *items; // 简单数据源(演示用) @property(nonatomic, strong, readonly)
NSArray<NSString *> *items; // 简单数据源(演示用)
// 子视图暴露,便于外部接入事件 // 子视图暴露,便于外部接入事件
@property (nonatomic, strong, readonly) KBFunctionBarView *barView; @property(nonatomic, strong, readonly) KBFunctionBarView *barView;
@property (nonatomic, strong, readonly) KBFunctionPasteView *pasteView; @property(nonatomic, strong, readonly) KBFunctionPasteView *pasteView;
@property (nonatomic, strong, readonly) UIButton *pasteButton; // 右侧-粘贴 @property(nonatomic, strong, readonly) UIButton *pasteButton; // 右侧-粘贴
@property (nonatomic, strong, readonly) UIButton *deleteButton; // 右侧-删除 @property(nonatomic, strong, readonly) UIButton *deleteButton; // 右侧-删除
@property (nonatomic, strong, readonly) UIButton *clearButton; // 右侧-清空 @property(nonatomic, strong, readonly) UIButton *clearButton; // 右侧-清空
@property (nonatomic, strong, readonly) UIButton *sendButton; // 右侧-发送 @property(nonatomic, strong, readonly) UIButton *sendButton; // 右侧-发送
/// 应用当前皮肤(更新背景/强调色) /// 应用当前皮肤(更新背景/强调色)
- (void)kb_applyTheme; - (void)kb_applyTheme;
#pragma mark - Theme Colors (用于 Cell 获取暗黑模式颜色)
/// Cell 背景色:暗黑 #707070浅色 白色90%透明度
+ (UIColor *)kb_cellBackgroundColor;
/// Cell 文字颜色:暗黑 #FFFFFF浅色 #1B1F1A
+ (UIColor *)kb_cellTextColor;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

File diff suppressed because it is too large Load Diff