修改国际化
This commit is contained in:
@@ -22,8 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 点击键盘 return 或右侧按钮时回调
|
||||
@property (nonatomic, copy) void(^onSearch)(NSString *keyword);
|
||||
|
||||
/// 占位文字,默认“Themes”
|
||||
@property (nonatomic, copy) NSString *placeholder;
|
||||
///// 占位文字,默认“Themes”
|
||||
//@property (nonatomic, copy) NSString *placeholder;
|
||||
|
||||
/// 外部可设置关键字
|
||||
- (void)updateKeyword:(NSString *)keyword;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
@interface KBSearchBarView () <UITextFieldDelegate>
|
||||
@property (nonatomic, strong) UIView *bgView; // 圆角背景
|
||||
@property (nonatomic, strong, readwrite) UITextField *textField; // 输入框
|
||||
@property (nonatomic, strong) UITextField *textField; // 输入框
|
||||
@property (nonatomic, strong) UIButton *searchButton; // 右侧搜索按钮
|
||||
@end
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
_textField.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
_textField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
_textField.returnKeyType = UIReturnKeySearch;
|
||||
_textField.placeholder = @"Themes"; // 默认占位
|
||||
_textField.placeholder = KBLocalized(@"Search Themes");
|
||||
|
||||
// 左侧占位图标
|
||||
UIView *pad = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 8, 8)];
|
||||
@@ -105,7 +105,7 @@
|
||||
if (!_searchButton) {
|
||||
_searchButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
_searchButton.titleLabel.font = [KBFont regular:14];
|
||||
[_searchButton setTitle:@"Search" forState:UIControlStateNormal];
|
||||
[_searchButton setTitle:KBLocalized(@"Search") forState:UIControlStateNormal];
|
||||
// 绿色样式
|
||||
[_searchButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_searchButton.backgroundColor = [UIColor colorWithRed:0.15 green:0.72 blue:0.62 alpha:1.0];
|
||||
@@ -118,10 +118,10 @@
|
||||
|
||||
#pragma mark - Public
|
||||
|
||||
- (void)setPlaceholder:(NSString *)placeholder {
|
||||
_placeholder = [placeholder copy];
|
||||
self.textField.placeholder = placeholder;
|
||||
}
|
||||
//- (void)setPlaceholder:(NSString *)placeholder {
|
||||
// _placeholder = [placeholder copy];
|
||||
// self.textField.placeholder = placeholder;
|
||||
//}
|
||||
|
||||
- (void)setBgCornerRadius:(CGFloat)bgCornerRadius {
|
||||
_bgCornerRadius = bgCornerRadius;
|
||||
|
||||
@@ -154,7 +154,7 @@ static NSString * const kResultCellId = @"KBSkinCardCell";
|
||||
- (KBSearchBarView *)searchBarView {
|
||||
if (!_searchBarView) {
|
||||
_searchBarView = [[KBSearchBarView alloc] init];
|
||||
_searchBarView.placeholder = @"Themes";
|
||||
// _searchBarView.placeholder = @"Themes";
|
||||
KBWeakSelf
|
||||
_searchBarView.onSearch = ^(NSString * _Nonnull keyword) {
|
||||
[weakSelf performSearch:keyword];
|
||||
|
||||
@@ -307,11 +307,11 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
|
||||
KBSearchSectionHeader *header = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:kHeaderId forIndexPath:indexPath];
|
||||
if (indexPath.section == KBSearchSectionHistory) {
|
||||
// 当没有历史时,外部通过 sizeForHeader 返回 0,这里仍设置但不会显示
|
||||
[header configWithTitle:@"Historical Search" showTrash:self.historyWords.count > 0];
|
||||
[header configWithTitle:KBLocalized(@"Historical Search") showTrash:self.historyWords.count > 0];
|
||||
KBWeakSelf
|
||||
header.onTapTrash = ^{ [weakSelf clearHistory]; };
|
||||
} else {
|
||||
[header configWithTitle:@"Recommended Skin" showTrash:NO];
|
||||
[header configWithTitle:KBLocalized(@"Recommended Skin") showTrash:NO];
|
||||
}
|
||||
return header;
|
||||
}
|
||||
@@ -391,7 +391,7 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
|
||||
if (!_searchBarView) {
|
||||
_searchBarView = [[KBSearchBarView alloc] init];
|
||||
_searchBarView.bgCornerRadius = 18;
|
||||
_searchBarView.placeholder = @"Themes";
|
||||
// _searchBarView.placeholder = @"Themes";
|
||||
KBWeakSelf
|
||||
_searchBarView.onSearch = ^(NSString * _Nonnull keyword) {
|
||||
// 置顶到历史 + 打开结果页
|
||||
|
||||
Reference in New Issue
Block a user