2
This commit is contained in:
@@ -174,9 +174,9 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
|
||||
// 交给 VM 统一处理 Apple 登录 + 服务端登录
|
||||
[[KBLoginVM shared] signInWithAppleFromViewController:KB_CURRENT_NAV completion:^(BOOL success, NSError * _Nullable error) {
|
||||
if (success) {
|
||||
[KBHUD showInfo:@"登录成功"];
|
||||
[KBHUD showInfo:KBLocalized(@"Signed in successfully")];
|
||||
} else {
|
||||
NSString *msg = error.localizedDescription ?: @"登录失败";
|
||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"Sign-in failed");
|
||||
[KBHUD showInfo:msg];
|
||||
}
|
||||
}];
|
||||
@@ -281,17 +281,17 @@ static BOOL KBIsKeyboardEnabled(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"网络不可用"
|
||||
message:@"请在“设置”中检查本应用的无线数据权限或网络连接。"
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:KBLocalized(@"Network unavailable")
|
||||
message:KBLocalized(@"Please check this app's wireless-data permission or network connection in Settings.")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction *settings = [UIAlertAction actionWithTitle:@"去设置"
|
||||
UIAlertAction *settings = [UIAlertAction actionWithTitle:KBLocalized(@"Open Settings")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self kb_openAppSettings]; // 你已经实现好的跳设置方法
|
||||
}];
|
||||
|
||||
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消"
|
||||
UIAlertAction *cancel = [UIAlertAction actionWithTitle:KBLocalized(@"Cancel")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil];
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
_useEmptyDataSet = YES; // 默认开启
|
||||
_emptyShouldAllowScroll = YES; // 默认允许滚动
|
||||
_emptyVerticalOffset = 0; // 默认不偏移
|
||||
_emptyTitleText = @"暂无数据"; // 默认标题
|
||||
_emptyTitleText = KBLocalized(@"暂无数据"); // 默认标题
|
||||
|
||||
#if KB_HAS_DZN
|
||||
self.emptyDataSetSource = self;
|
||||
@@ -148,7 +148,7 @@
|
||||
self.useEmptyDataSet = NO;
|
||||
|
||||
// 默认文案
|
||||
NSString *t = title ?: @"暂无数据";
|
||||
NSString *t = title ?: KBLocalized(@"暂无数据");
|
||||
|
||||
LYEmptyView *ev = nil;
|
||||
if (buttonTitle.length > 0) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
tapHandler:(KBEmptyAction)tapHandler
|
||||
buttonHandler:(KBEmptyAction)buttonHandler {
|
||||
#if KB_HAS_LY
|
||||
NSString *t = title ?: @"暂无数据";
|
||||
NSString *t = title ?: KBLocalized(@"暂无数据");
|
||||
LYEmptyView *ev = nil;
|
||||
|
||||
if (buttonTitle.length > 0) {
|
||||
@@ -87,4 +87,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -31,29 +31,29 @@
|
||||
// 首页
|
||||
HomeMainVC *home = [[HomeMainVC alloc] init];
|
||||
BaseNavigationController *navHome = [[BaseNavigationController alloc] initWithRootViewController:home];
|
||||
navHome.tabBarItem = [self tabItemWithTitle:@"首页"
|
||||
navHome.tabBarItem = [self tabItemWithTitle:KBLocalized(@"Home")
|
||||
image:@"tab_home"
|
||||
selectedImg:@"tab_home_selected"];
|
||||
|
||||
// 商城
|
||||
KBShopVC *shop = [[KBShopVC alloc] init];
|
||||
BaseNavigationController *navShop = [[BaseNavigationController alloc] initWithRootViewController:shop];
|
||||
navShop.tabBarItem = [self tabItemWithTitle:@"商城"
|
||||
navShop.tabBarItem = [self tabItemWithTitle:KBLocalized(@"Shop")
|
||||
image:@"tab_shop"
|
||||
selectedImg:@"tab_shop_selected"];
|
||||
|
||||
// 社区
|
||||
KBCommunityVC *community = [[KBCommunityVC alloc] init];
|
||||
community.title = @"社区";
|
||||
community.title = KBLocalized(@"社区");
|
||||
BaseNavigationController *navCommunity = [[BaseNavigationController alloc] initWithRootViewController:community];
|
||||
navCommunity.tabBarItem = [self tabItemWithTitle:@"社区"
|
||||
navCommunity.tabBarItem = [self tabItemWithTitle:KBLocalized(@"Circle")
|
||||
image:@"tab_shequ"
|
||||
selectedImg:@"tab_shequ_selected"];
|
||||
|
||||
// 我的
|
||||
MyVC *my = [[MyVC alloc] init];
|
||||
BaseNavigationController *navMy = [[BaseNavigationController alloc] initWithRootViewController:my];
|
||||
navMy.tabBarItem = [self tabItemWithTitle:@"我的"
|
||||
navMy.tabBarItem = [self tabItemWithTitle:KBLocalized(@"Mine")
|
||||
image:@"tab_my"
|
||||
selectedImg:@"tab_my_selected"];
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ static __weak UIViewController *sDefaultPresenter = nil; // 可选外部指定
|
||||
[self _markFinishedAndContinue];
|
||||
return;
|
||||
}
|
||||
NSString *ok = button ?: (NSLocalizedString(@"OK", nil).length ? NSLocalizedString(@"OK", nil) : @"好");
|
||||
NSString *ok = button ?: (NSLocalizedString(@"OK", nil).length ? NSLocalizedString(@"OK", nil) : KBLocalized(@"好"));
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:(title ?: @"")
|
||||
message:(message ?: @"")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
@@ -138,8 +138,8 @@ static inline void KBSetActionTitleColor(UIAlertAction *action, UIColor *color)
|
||||
[self enqueuePresent:^{
|
||||
UIViewController *vc = [self presentingVC];
|
||||
if (!vc) { [self _markFinishedAndContinue]; return; }
|
||||
NSString *ok = okTitle ?: @"确定";
|
||||
NSString *cancel = cancelTitle ?: @"取消";
|
||||
NSString *ok = okTitle ?: KBLocalized(@"Confirm");
|
||||
NSString *cancel = cancelTitle ?: KBLocalized(@"Cancel");
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:(title ?: @"")
|
||||
message:(message ?: @"")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
@@ -175,8 +175,8 @@ static inline void KBSetActionTitleColor(UIAlertAction *action, UIColor *color)
|
||||
[self enqueuePresent:^{
|
||||
UIViewController *vc = [self presentingVC];
|
||||
if (!vc) { [self _markFinishedAndContinue]; return; }
|
||||
NSString *ok = okTitle ?: @"确定";
|
||||
NSString *cancel = cancelTitle ?: @"取消";
|
||||
NSString *ok = okTitle ?: KBLocalized(@"Confirm");
|
||||
NSString *cancel = cancelTitle ?: KBLocalized(@"Cancel");
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:(title ?: @"")
|
||||
message:(message ?: @"")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
@@ -169,10 +169,10 @@ static __weak UIView *sContainerView = nil; // 缺省承载视图(
|
||||
|
||||
+ (void)showSuccess:(NSString *)status {
|
||||
// 简单起见,使用文字模式;如需图标,可替换为自定义勾勾图片
|
||||
[self _showText:status ?: @"成功" icon:nil];
|
||||
[self _showText:status ?: KBLocalized(@"Success") icon:nil];
|
||||
}
|
||||
|
||||
+ (void)showError:(NSString *)status { [self _showText:status ?: @"失败" icon:nil]; }
|
||||
+ (void)showError:(NSString *)status { [self _showText:status ?: KBLocalized(@"Failed") icon:nil]; }
|
||||
|
||||
+ (void)dismiss { [self onMain:^{ [sHUD hideAnimated:YES]; }]; }
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
_titleLabel.numberOfLines = 0;
|
||||
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_titleLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.0];
|
||||
_titleLabel.text = @"👋 欢迎使用『Lovekey 键盘』";
|
||||
_titleLabel.text = KBLocalized(@"👋 Welcome to Key of Love Keyboard");
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
@@ -124,7 +124,7 @@
|
||||
_descLabel.numberOfLines = 0;
|
||||
_descLabel.font = [UIFont systemFontOfSize:14];
|
||||
_descLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.0];
|
||||
_descLabel.text = @"点击任一对话去粘贴,选择任意回复方式去试用吧~";
|
||||
_descLabel.text = KBLocalized(@"Tap any conversation to paste, then try any reply style~");
|
||||
}
|
||||
return _descLabel;
|
||||
}
|
||||
@@ -137,7 +137,7 @@
|
||||
_q1Label = [UILabel new];
|
||||
_q1Label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_q1Label.textColor = [UIColor blackColor];
|
||||
_q1Label.text = @"在干嘛?";
|
||||
_q1Label.text = KBLocalized(@"What are you doing?");
|
||||
}
|
||||
return _q1Label;
|
||||
}
|
||||
@@ -147,10 +147,9 @@
|
||||
_q2Label = [UILabel new];
|
||||
_q2Label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_q2Label.textColor = [UIColor blackColor];
|
||||
_q2Label.text = @"我去洗澡了";
|
||||
_q2Label.text = KBLocalized(@"I'm going to take a shower.");
|
||||
}
|
||||
return _q2Label;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
|
||||
self.title = @"使用引导";
|
||||
// self.title = KBLocalized(@"使用引导");
|
||||
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.inputBar];
|
||||
@@ -176,7 +176,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
||||
// 1. 插入我方消息
|
||||
[self.items addObject:@{ @"type": @(KBGuideItemTypeUser), @"text": text ?: @"" }];
|
||||
// 2. 紧跟一条固定客服消息
|
||||
NSString *reply = @"🎉 如您遇到其他问题,可点击在线客服帮您解决~";
|
||||
NSString *reply = KBLocalized(@"🎉 If you run into any other issues, tap Online Support to get help~");
|
||||
[self.items addObject:@{ @"type": @(KBGuideItemTypeKF), @"text": reply }];
|
||||
|
||||
// 刷新并滚动到底部
|
||||
@@ -273,7 +273,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
||||
self.kb_lastInputModeIdentifier = currId;
|
||||
|
||||
BOOL isMine = [currId rangeOfString:KB_KEYBOARD_EXTENSION_BUNDLE_ID].location != NSNotFound;
|
||||
[KBHUD showInfo:(isMine ? @"是自己的键盘" : @"❎不是自己的键盘")];
|
||||
[KBHUD showInfo:(isMine ? KBLocalized(@"是自己的键盘") : KBLocalized(@"❎不是自己的键盘"))];
|
||||
}
|
||||
|
||||
/// 当权限满足时,尽力激活输入框,从而触发键盘挂载与输入法检测
|
||||
@@ -368,7 +368,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
||||
_textField.delegate = self;
|
||||
_textField.returnKeyType = UIReturnKeySend; // 回车发送
|
||||
_textField.font = [UIFont systemFontOfSize:15];
|
||||
_textField.placeholder = @"在键盘粘贴对话后,选择回复方式";
|
||||
_textField.placeholder = KBLocalized(@"After pasting the conversation in the keyboard, choose a reply style");
|
||||
_textField.backgroundColor = [UIColor whiteColor];
|
||||
_textField.layer.cornerRadius = 10; _textField.layer.masksToBounds = YES;
|
||||
UIView *pad = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 36)];
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
self.title = KBLocalized(@"lang_test_title");
|
||||
NSString *code = [KBLocalizationManager shared].currentLanguageCode ?: @"";
|
||||
NSString *fmt = KBLocalized(@"current_lang");
|
||||
self.label.text = [NSString stringWithFormat:fmt.length ? fmt : @"当前:%@", code];
|
||||
NSString *fallback = KBLocalized(@"当前:%@");
|
||||
self.label.text = [NSString stringWithFormat:fmt.length ? fmt : fallback, code];
|
||||
[self.toggleBtn setTitle:KBLocalized(@"lang_toggle") forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
@@ -57,4 +58,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
_applyBtn = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_applyBtn setTitle:@"下载并应用" forState:UIControlStateNormal];
|
||||
[_applyBtn setTitle:KBLocalized(@"Download & Apply") forState:UIControlStateNormal];
|
||||
_applyBtn.layer.cornerRadius = 6; _applyBtn.layer.borderWidth = 1;
|
||||
_applyBtn.layer.borderColor = [UIColor colorWithWhite:0.85 alpha:1].CGColor;
|
||||
[self.contentView addSubview:_applyBtn];
|
||||
@@ -41,14 +41,14 @@
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"皮肤中心";
|
||||
self.title = KBLocalized(@"皮肤中心");
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
// 绝对 URL 的测试皮肤图片(无需 KB_BASE_URL)。
|
||||
// 说明:使用 picsum.photos 的固定 id,稳定可直接访问。
|
||||
self.skins = @[
|
||||
@{ @"id": @"aurora", @"name": @"极光", @"img": @"https://picsum.photos/id/1018/1600/900.jpg" },
|
||||
@{ @"id": @"alps", @"name": @"雪山", @"img": @"https://picsum.photos/id/1016/1600/900.jpg" },
|
||||
@{ @"id": @"lake", @"name": @"湖面", @"img": @"https://picsum.photos/id/1039/1600/900.jpg" },
|
||||
@{ @"id": @"aurora", @"name": KBLocalized(@"极光"), @"img": @"https://picsum.photos/id/1018/1600/900.jpg" },
|
||||
@{ @"id": @"alps", @"name": KBLocalized(@"雪山"), @"img": @"https://picsum.photos/id/1016/1600/900.jpg" },
|
||||
@{ @"id": @"lake", @"name": KBLocalized(@"湖面"), @"img": @"https://picsum.photos/id/1039/1600/900.jpg" },
|
||||
];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleInsetGrouped];
|
||||
@@ -124,7 +124,7 @@
|
||||
payload = UIImageJPEGRepresentation(img, 0.9);
|
||||
}
|
||||
BOOL ok = (payload.length > 0) ? [[KBSkinManager shared] applyImageSkinWithData:payload skinId:skin[@"id"] name:skin[@"name"]] : NO;
|
||||
[KBHUD showInfo:(ok ? @"已应用,切到键盘查看" : @"应用失败")];
|
||||
[KBHUD showInfo:(ok ? KBLocalized(@"已应用,切到键盘查看") : KBLocalized(@"应用失败"))];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
self.tableView.tableHeaderView = header;
|
||||
[self.view addSubview:self.tableView];
|
||||
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), @"皮肤中心" ];
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心") ];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{ [self.textView becomeFirstResponder]; });
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
- (void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
self.title = KBLocalized(@"home_title");
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), @"皮肤中心" ];
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心") ];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,12 @@
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
self.titles = @[@"螃蟹啊斯柯达积分卡", @"小龙虾", @"苹果", @"胡萝卜", @"葡萄", @"西瓜"];
|
||||
self.titles = @[KBLocalized(@"螃蟹啊斯柯达积分卡"),
|
||||
KBLocalized(@"小龙虾"),
|
||||
KBLocalized(@"苹果"),
|
||||
KBLocalized(@"胡萝卜"),
|
||||
KBLocalized(@"葡萄"),
|
||||
KBLocalized(@"西瓜")];
|
||||
[self.view addSubview:self.myCategoryView];
|
||||
[self.view addSubview:self.listContainerView];
|
||||
self.listContainerView.scrollView.scrollEnabled = false;
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
// 两个按钮
|
||||
self.hotButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[self.hotButton setTitle:@"热门" forState:UIControlStateNormal];
|
||||
[self.hotButton setTitle:KBLocalized(@"热门") forState:UIControlStateNormal];
|
||||
[self.hotButton setTitleColor:[UIColor darkTextColor] forState:UIControlStateNormal];
|
||||
[self.hotButton setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
|
||||
self.hotButton.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
@@ -146,7 +146,7 @@
|
||||
[self.topBar addSubview:self.hotButton];
|
||||
|
||||
self.rankButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[self.rankButton setTitle:@"排行" forState:UIControlStateNormal];
|
||||
[self.rankButton setTitle:KBLocalized(@"排行") forState:UIControlStateNormal];
|
||||
[self.rankButton setTitleColor:[UIColor darkTextColor] forState:UIControlStateNormal];
|
||||
[self.rankButton setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
|
||||
self.rankButton.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
}];
|
||||
} else {
|
||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[btn setTitle:@"需要 iOS13+ 才能使用 Apple 登录" forState:UIControlStateNormal];
|
||||
[btn setTitle:KBLocalized(@"需要 iOS13+ 才能使用 Apple 登录") forState:UIControlStateNormal];
|
||||
btn.enabled = NO;
|
||||
btn.layer.cornerRadius = 8.0;
|
||||
btn.layer.borderWidth = 1.0;
|
||||
@@ -100,7 +100,7 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = @"登录后可使用全部功能";
|
||||
_titleLabel.text = KBLocalized(@"Sign in to unlock all features");
|
||||
_titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
||||
_titleLabel.textColor = [UIColor blackColor];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
@@ -112,7 +112,7 @@
|
||||
- (UILabel *)descLabel {
|
||||
if (!_descLabel) {
|
||||
_descLabel = [UILabel new];
|
||||
_descLabel.text = @"我们将使用 Apple 进行快速安全登录";
|
||||
_descLabel.text = KBLocalized(@"We'll use Apple for a quick, secure sign-in");
|
||||
_descLabel.font = [UIFont systemFontOfSize:14];
|
||||
_descLabel.textColor = [UIColor colorWithWhite:0.2 alpha:0.8];
|
||||
_descLabel.textAlignment = NSTextAlignmentCenter;
|
||||
@@ -140,4 +140,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = @"登录";
|
||||
_titleLabel.text = KBLocalized(@"Log In");
|
||||
_titleLabel.font = [UIFont boldSystemFontOfSize:24];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
@@ -107,7 +107,7 @@
|
||||
- (UIButton *)compatHintButton {
|
||||
if (!_compatHintButton) {
|
||||
_compatHintButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_compatHintButton setTitle:@"需要 iOS13+ 才能使用 Apple 登录" forState:UIControlStateNormal];
|
||||
[_compatHintButton setTitle:KBLocalized(@"需要 iOS13+ 才能使用 Apple 登录") forState:UIControlStateNormal];
|
||||
_compatHintButton.enabled = NO;
|
||||
}
|
||||
return _compatHintButton;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
[[AppleSignInManager shared] signInFromViewController:presenter completion:^(ASAuthorizationAppleIDCredential * _Nullable credential, NSError * _Nullable error) {
|
||||
if (error) { if (completion) completion(NO, error); return; }
|
||||
if (![credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
|
||||
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-1 userInfo:@{NSLocalizedDescriptionKey: @"无效的登录凭证"}]);
|
||||
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-1 userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"无效的登录凭证")}]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
self.currentUser = user;
|
||||
NSString *token = user.token ?: [self.class tokenFromResponseObject:jsonOrData];
|
||||
if (token.length == 0) {
|
||||
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-2 userInfo:@{NSLocalizedDescriptionKey: @"未返回 token"}]);
|
||||
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-2 userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"未返回 token")}]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
refreshToken:nil
|
||||
expiryDate:nil
|
||||
userIdentifier:cred.user];
|
||||
if (completion) completion(ok, ok ? nil : [NSError errorWithDomain:@"KBLogin" code:-3 userInfo:@{NSLocalizedDescriptionKey: @"保存登录态失败"}]);
|
||||
if (completion) completion(ok, ok ? nil : [NSError errorWithDomain:@"KBLogin" code:-3 userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"保存登录态失败")}]);
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ static NSString * const kKBAppleUserIdentifierKey = @"com.company.keyboard.apple
|
||||
[controller performRequests];
|
||||
} else {
|
||||
if (completion) {
|
||||
NSError *err = [NSError errorWithDomain:@"AppleSignIn" code:-1 userInfo:@{NSLocalizedDescriptionKey: @"Apple 登录需要 iOS 13 及以上版本"}];
|
||||
NSError *err = [NSError errorWithDomain:@"AppleSignIn" code:-1 userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"Sign in with Apple requires iOS 13 or later")}];
|
||||
completion(nil, err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = @"Change The Nickname";
|
||||
_titleLabel.text = KBLocalized(@"Change The Nickname");
|
||||
_titleLabel.textColor = [UIColor blackColor];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:22 weight:UIFontWeightBold];
|
||||
}
|
||||
@@ -141,7 +141,7 @@
|
||||
[_closeButton setTitleColor:[UIColor colorWithWhite:0.3 alpha:1] forState:UIControlStateNormal];
|
||||
_closeButton.tintColor = [UIColor colorWithWhite:0.3 alpha:1];
|
||||
[_closeButton addTarget:self action:@selector(onTapClose) forControlEvents:UIControlEventTouchUpInside];
|
||||
_closeButton.accessibilityLabel = @"关闭";
|
||||
_closeButton.accessibilityLabel = KBLocalized(@"Close");
|
||||
}
|
||||
return _closeButton;
|
||||
}
|
||||
@@ -161,7 +161,7 @@
|
||||
_textField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
_textField.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_textField.textColor = [UIColor blackColor];
|
||||
_textField.placeholder = @"Please Enter The Modified Nickname";
|
||||
_textField.placeholder = KBLocalized(@"Please Enter The Modified Nickname");
|
||||
}
|
||||
return _textField;
|
||||
}
|
||||
@@ -169,7 +169,7 @@
|
||||
- (UIButton *)saveButton {
|
||||
if (!_saveButton) {
|
||||
_saveButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_saveButton setTitle:@"Save" forState:UIControlStateNormal];
|
||||
[_saveButton setTitle:KBLocalized(@"Save") forState:UIControlStateNormal];
|
||||
[_saveButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_saveButton.titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||
_saveButton.backgroundColor = [UIColor colorWithRed:0.02 green:0.75 blue:0.67 alpha:1.0];
|
||||
@@ -180,4 +180,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
_minusTapArea = [[UIControl alloc] init];
|
||||
_minusTapArea.backgroundColor = [UIColor clearColor];
|
||||
// 提高命中率:即使轻微偏离也能点中
|
||||
_minusTapArea.accessibilityLabel = @"删除";
|
||||
_minusTapArea.accessibilityLabel = KBLocalized(@"Delete");
|
||||
}
|
||||
return _minusTapArea;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
}];
|
||||
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.right.equalTo(self.cardView);
|
||||
make.height.equalTo(self.cardView.mas_width).multipliedBy(0.66); // 接近截图比例
|
||||
make.height.mas_equalTo(KBFit(126));
|
||||
}];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.cardView).offset(12);
|
||||
|
||||
@@ -163,23 +163,10 @@ static NSString * const kKBMyKeyboardCellId = @"kKBMyKeyboardCellId";
|
||||
if (!self) { return; }
|
||||
NSIndexPath *tapIndexPath = [weakCV indexPathForCell:tappedCell];
|
||||
if (!tapIndexPath) { return; }
|
||||
// [KBAlert confirmTitle:@"删除该标签?" message:@"删除后不可恢复" completion:^(BOOL ok) {
|
||||
// if (!ok) { return; }
|
||||
// // 更新数据源并删除 item
|
||||
// if (tapIndexPath.section < self.dataSourceArray.count) {
|
||||
// NSMutableArray *section = self.dataSourceArray[tapIndexPath.section];
|
||||
// if (tapIndexPath.item < section.count) {
|
||||
// [section removeObjectAtIndex:tapIndexPath.item];
|
||||
// [self.collectionView performBatchUpdates:^{
|
||||
// [self.collectionView deleteItemsAtIndexPaths:@[tapIndexPath]];
|
||||
// } completion:nil];
|
||||
// }
|
||||
// }
|
||||
// }];
|
||||
[KBAlert confirmTitle:@"删除该标签?"
|
||||
message:@"删除后不可恢复"
|
||||
ok:@"确定"
|
||||
cancel:@"取消"
|
||||
[KBAlert confirmTitle:KBLocalized(@"Delete this tag?")
|
||||
message:KBLocalized(@"This action cannot be undone")
|
||||
ok:KBLocalized(@"Confirm")
|
||||
cancel:KBLocalized(@"Cancel")
|
||||
okColor:[UIColor redColor]
|
||||
cancelColor:[UIColor blackColor]
|
||||
completion:^(BOOL ok) {
|
||||
@@ -229,7 +216,7 @@ static NSString * const kKBMyKeyboardCellId = @"kKBMyKeyboardCellId";
|
||||
- (void)onSave {
|
||||
// 这里只做示意:保存当前顺序
|
||||
NSLog(@"保存顺序: %@", self.dataSourceArray);
|
||||
[KBHUD showInfo:@"已保存"];
|
||||
[KBHUD showInfo:KBLocalized(@"Saved")];
|
||||
}
|
||||
|
||||
#pragma mark - Lazy UI
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
NSString *userID = self.items[2][@"value"];
|
||||
if (userID.length == 0) return;
|
||||
UIPasteboard.generalPasteboard.string = userID;
|
||||
[KBHUD showInfo:@"复制成功"];
|
||||
[KBHUD showInfo:KBLocalized(@"Copy Success")];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,11 +55,8 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
make.left.equalTo(self.view).offset(15);
|
||||
make.right.equalTo(self.view).offset(-15);
|
||||
make.height.mas_equalTo([KBSkinBottomActionView preferredHeight]);
|
||||
if (@available(iOS 11.0, *)) {
|
||||
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
|
||||
} else {
|
||||
make.bottom.equalTo(self.view);
|
||||
}
|
||||
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-10);
|
||||
|
||||
}];
|
||||
|
||||
// 列表底部距离操作条顶部 10
|
||||
|
||||
@@ -61,9 +61,9 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
|
||||
// 空态视图(LYEmptyView)统一样式 + 重试按钮
|
||||
KBWeakSelf
|
||||
[self.collectionView kb_makeDefaultEmptyViewWithImage:nil
|
||||
title:@"暂无皮肤"
|
||||
detail:@"下拉刷新试试"
|
||||
buttonTitle:@"重试"
|
||||
title:KBLocalized(@"No skins yet")
|
||||
detail:KBLocalized(@"Pull down to refresh")
|
||||
buttonTitle:KBLocalized(@"Retry")
|
||||
tapHandler:nil
|
||||
buttonHandler:^{ [weakSelf.collectionView.mj_header beginRefreshing]; }];
|
||||
[self.collectionView kb_setLYAutoShowEnabled:NO]; // 采用手动控制显隐
|
||||
@@ -224,7 +224,7 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
|
||||
CGFloat spacing = 12;
|
||||
CGFloat W = UIScreen.mainScreen.bounds.size.width;
|
||||
CGFloat itemW = floor((W - inset * 2 - spacing) / 2.0);
|
||||
CGFloat itemH = itemW * 0.82f; // 接近截图比例
|
||||
CGFloat itemH = KBFit(168); // 接近截图比例
|
||||
layout.itemSize = CGSizeMake(itemW, itemH);
|
||||
layout.minimumInteritemSpacing = spacing;
|
||||
layout.minimumLineSpacing = spacing;
|
||||
|
||||
@@ -62,7 +62,7 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
|
||||
parameters:parameters
|
||||
error:&serror];
|
||||
if (serror || !req) {
|
||||
if (completion) completion(nil, nil, serror ?: [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey: @"无效的URL"}]);
|
||||
if (completion) completion(nil, nil, serror ?: [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"Invalid URL")}]);
|
||||
return nil;
|
||||
}
|
||||
[self applyHeaders:headers toMutableRequest:req contentType:nil];
|
||||
@@ -109,7 +109,7 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
|
||||
|
||||
- (BOOL)ensureEnabled:(KBNetworkCompletion)completion {
|
||||
if (!self.isEnabled) {
|
||||
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorDisabled userInfo:@{NSLocalizedDescriptionKey: @"网络未启用(可能未开启完全访问)"}];
|
||||
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorDisabled userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"Network disabled (Full Access may be off)")}];
|
||||
if (completion) completion(nil, nil, e);
|
||||
return NO;
|
||||
}
|
||||
@@ -162,12 +162,12 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
|
||||
}
|
||||
NSData *data = (NSData *)responseObject;
|
||||
if (![data isKindOfClass:[NSData class]]) {
|
||||
#if DEBUG
|
||||
KBLOG(@"无效响应\nURL: %@\n说明: %@", req.URL.absoluteString, @"未获取到数据");
|
||||
#endif
|
||||
if (completion) completion(nil, response, [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorInvalidResponse userInfo:@{NSLocalizedDescriptionKey:@"无数据"}]);
|
||||
return;
|
||||
}
|
||||
#if DEBUG
|
||||
KBLOG(@"无效响应\nURL: %@\n说明: %@", req.URL.absoluteString, KBLocalized(@"未获取到数据"));
|
||||
#endif
|
||||
if (completion) completion(nil, response, [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorInvalidResponse userInfo:@{NSLocalizedDescriptionKey:KBLocalized(@"No data")}]);
|
||||
return;
|
||||
}
|
||||
NSString *ct = nil;
|
||||
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||
ct = ((NSHTTPURLResponse *)response).allHeaderFields[@"Content-Type"];
|
||||
@@ -189,12 +189,12 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
|
||||
NSError *jsonErr = nil;
|
||||
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonErr];
|
||||
if (jsonErr) {
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
KBLOG(@"响应解析失败(JSON)\nURL: %@\n错误: %@",
|
||||
req.URL.absoluteString,
|
||||
jsonErr.localizedDescription);
|
||||
#endif
|
||||
if (completion) completion(nil, response, [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorDecodeFailed userInfo:@{NSLocalizedDescriptionKey:@"JSON解析失败"}]);
|
||||
#endif
|
||||
if (completion) completion(nil, response, [NSError errorWithDomain:KBNetworkErrorDomain code:KBNetworkErrorDecodeFailed userInfo:@{NSLocalizedDescriptionKey:KBLocalized(@"Failed to parse JSON")}]);
|
||||
return;
|
||||
}
|
||||
#if DEBUG
|
||||
@@ -243,20 +243,20 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
|
||||
|
||||
#pragma mark - Private helpers
|
||||
|
||||
- (void)fail:(KBNetworkError)code completion:(KBNetworkCompletion)completion {
|
||||
NSString *msg = @"网络错误";
|
||||
switch (code) {
|
||||
case KBNetworkErrorDisabled: msg = @"网络未启用(可能未开启完全访问)"; break;
|
||||
case KBNetworkErrorInvalidURL: msg = @"无效的URL"; break;
|
||||
case KBNetworkErrorInvalidResponse: msg = @"无效的响应"; break;
|
||||
case KBNetworkErrorDecodeFailed: msg = @"解析失败"; break;
|
||||
default: break;
|
||||
- (void)fail:(KBNetworkError)code completion:(KBNetworkCompletion)completion {
|
||||
NSString *msg = KBLocalized(@"Network error");
|
||||
switch (code) {
|
||||
case KBNetworkErrorDisabled: msg = KBLocalized(@"Network disabled (Full Access may be off)"); break;
|
||||
case KBNetworkErrorInvalidURL: msg = KBLocalized(@"Invalid URL"); break;
|
||||
case KBNetworkErrorInvalidResponse: msg = KBLocalized(@"Invalid response"); break;
|
||||
case KBNetworkErrorDecodeFailed: msg = KBLocalized(@"Parse failed"); break;
|
||||
default: break;
|
||||
}
|
||||
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
|
||||
code:code
|
||||
userInfo:@{NSLocalizedDescriptionKey: msg}];
|
||||
if (completion) completion(nil, nil, e);
|
||||
}
|
||||
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
|
||||
code:code
|
||||
userInfo:@{NSLocalizedDescriptionKey: msg}];
|
||||
if (completion) completion(nil, nil, e);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.payVM applePayReqWithParams:params needShow:NO completion:^(NSInteger sta, NSString * _Nullable msg) {
|
||||
[KBHUD dismiss];
|
||||
[KBHUD showInfo:(sta == ERROR_CODE ? @"支付失败" : @"支付成功")];
|
||||
[KBHUD showInfo:(sta == ERROR_CODE ? KBLocalized(@"Payment failed") : KBLocalized(@"Payment successful"))];
|
||||
if (sta == SUCCESS_CODE) {
|
||||
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
|
||||
if (handler) handler(@"成功", nil);
|
||||
if (handler) handler(KBLocalized(@"Success"), nil);
|
||||
} else {
|
||||
if (handler) handler(@"失败", nil);
|
||||
if (handler) handler(KBLocalized(@"Failed"), nil);
|
||||
}
|
||||
(void)weakSelf; // keep self during block life if needed
|
||||
}];
|
||||
@@ -68,4 +68,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
|
||||
}
|
||||
|
||||
- (void)agreementButtonAction{
|
||||
[KBHUD showInfo:@"跳转协议"];
|
||||
[KBHUD showInfo:KBLocalized(@"Open agreement")];
|
||||
}
|
||||
|
||||
#pragma mark - Lazy UI
|
||||
|
||||
@@ -127,10 +127,10 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
#pragma mark - Bottom Actions
|
||||
- (void)onTapPayButton {
|
||||
// TODO: 接入支付,这里仅做 UI
|
||||
[KBHUD showInfo:@"Pay clicked"];
|
||||
[KBHUD showInfo:KBLocalized(@"Pay clicked")];
|
||||
}
|
||||
- (void)agreementButtonAction{
|
||||
[KBHUD showInfo:@"跳转协议"];
|
||||
[KBHUD showInfo:KBLocalized(@"Open agreement")];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionView DataSource
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
if (needShow) { [KBHUD dismiss]; }
|
||||
|
||||
if (error) {
|
||||
if (completion) completion(ERROR_CODE, error.localizedDescription ?: @"网络错误");
|
||||
if (completion) completion(ERROR_CODE, error.localizedDescription ?: KBLocalized(@"Network error"));
|
||||
return;
|
||||
}
|
||||
|
||||
NSInteger sta = [self.class extractStatusFromResponseObject:jsonOrData response:response];
|
||||
NSString *msg = [self.class extractMessageFromResponseObject:jsonOrData] ?: (sta == SUCCESS_CODE ? @"OK" : @"失败");
|
||||
NSString *msg = [self.class extractMessageFromResponseObject:jsonOrData] ?: (sta == SUCCESS_CODE ? @"OK" : KBLocalized(@"Failed"));
|
||||
if (completion) completion(sta, msg);
|
||||
}];
|
||||
}
|
||||
@@ -62,4 +62,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
- (void)tapTrash {
|
||||
// 弹出确认框:是否删除所有历史记录
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[KBAlert confirmTitle:@"清空历史"
|
||||
message:@"是否删除所有历史记录?"
|
||||
ok:@"确定"
|
||||
cancel:@"取消"
|
||||
[KBAlert confirmTitle:KBLocalized(@"Clear history")
|
||||
message:KBLocalized(@"Delete all history?")
|
||||
ok:KBLocalized(@"Confirm")
|
||||
cancel:KBLocalized(@"Cancel")
|
||||
okColor:weakSelf.confirmColor
|
||||
cancelColor:weakSelf.cancelColor
|
||||
completion:^(BOOL ok) {
|
||||
|
||||
@@ -83,7 +83,12 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
|
||||
}];
|
||||
|
||||
// 初始化测试数据
|
||||
self.historyWords = [@[@"果冻橙", @"芒果", @"有机水果卷心菜", @"水果萝卜", @"熟冻帝王蟹", @"赣南脐橙"] mutableCopy];
|
||||
self.historyWords = [@[KBLocalized(@"果冻橙"),
|
||||
KBLocalized(@"芒果"),
|
||||
KBLocalized(@"有机水果卷心菜"),
|
||||
KBLocalized(@"水果萝卜"),
|
||||
KBLocalized(@"熟冻帝王蟹"),
|
||||
KBLocalized(@"赣南脐橙")] mutableCopy];
|
||||
self.recommendItems = @[
|
||||
@{@"title":@"Dopamine", @"price":@"20"},
|
||||
@{@"title":@"Dopamine", @"price":@"20"},
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
if (self.isNeedFooter) {
|
||||
self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[weakSelf.dataSource addObject:@"加载更多成功"]; // 模拟新增一条
|
||||
[weakSelf.dataSource addObject:KBLocalized(@"Loaded more successfully")]; // 模拟新增一条
|
||||
[weakSelf.collectionView reloadData];
|
||||
[weakSelf.collectionView.mj_footer endRefreshing];
|
||||
});
|
||||
|
||||
@@ -76,7 +76,10 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.navigationController.navigationBar.translucent = false;
|
||||
self.edgesForExtendedLayout = UIRectEdgeNone;
|
||||
_titles = @[@"能力", @"爱好", @"队友",@"能力2", @"爱好2", @"队友2",@"能力", @"爱好", @"队友",@"能力2", @"爱好2", @"队友2"];
|
||||
_titles = @[KBLocalized(@"能力"), KBLocalized(@"爱好"), KBLocalized(@"队友"),
|
||||
KBLocalized(@"能力2"), KBLocalized(@"爱好2"), KBLocalized(@"队友2"),
|
||||
KBLocalized(@"能力"), KBLocalized(@"爱好"), KBLocalized(@"队友"),
|
||||
KBLocalized(@"能力2"), KBLocalized(@"爱好2"), KBLocalized(@"队友2")];
|
||||
|
||||
_userHeaderView = [[KBShopHeadView alloc] init];
|
||||
_categoryView = (JXCategoryTitleView *)[[KBCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, JXheightForHeaderInSection)];
|
||||
@@ -130,8 +133,8 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
|
||||
__weak typeof(self)weakSelf = self;
|
||||
self.pagerView.mainTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
self.categoryView.titles = @[@"高级能力", @"高级爱好", @"高级队友"];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
self.categoryView.titles = @[KBLocalized(@"高级能力"), KBLocalized(@"高级爱好"), KBLocalized(@"高级队友")];
|
||||
self.categoryView.defaultSelectedIndex = 0;
|
||||
[self.categoryView reloadData];
|
||||
[self.pagerView reloadData];
|
||||
@@ -147,7 +150,7 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
self.naviBGView.frame = CGRectMake(0, 0, KB_SCREEN_WIDTH, KB_NAV_TOTAL_HEIGHT);
|
||||
[self.view addSubview:self.naviBGView];
|
||||
UILabel *naviTitleLabel = [[UILabel alloc] init];
|
||||
naviTitleLabel.text = @"商城";
|
||||
naviTitleLabel.text = KBLocalized(@"商城");
|
||||
naviTitleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
naviTitleLabel.frame = CGRectMake(0, KB_STATUSBAR_HEIGHT, self.view.bounds.size.width, 44);
|
||||
[self.naviBGView addSubview:naviTitleLabel];
|
||||
@@ -192,11 +195,18 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
list.isNeedHeader = self.isNeedHeader;
|
||||
list.isNeedFooter = self.isNeedFooter;
|
||||
if (index == 0) {
|
||||
list.dataSource = @[@"橡胶火箭", @"橡胶火箭炮", @"橡胶机关枪", @"橡胶子弹", @"橡胶攻城炮", @"橡胶象枪", @"橡胶象枪乱打", @"橡胶灰熊铳", @"橡胶雷神象枪", @"橡胶猿王枪", @"橡胶犀·榴弹炮", @"橡胶大蛇炮", @"橡胶火箭", @"橡胶火箭炮", @"橡胶机关枪", @"橡胶子弹", @"橡胶攻城炮", @"橡胶象枪", @"橡胶象枪乱打", @"橡胶灰熊铳", @"橡胶雷神象枪", @"橡胶猿王枪", @"橡胶犀·榴弹炮", @"橡胶大蛇炮"].mutableCopy;
|
||||
list.dataSource = @[KBLocalized(@"橡胶火箭"), KBLocalized(@"橡胶火箭炮"), KBLocalized(@"橡胶机关枪"), KBLocalized(@"橡胶子弹"),
|
||||
KBLocalized(@"橡胶攻城炮"), KBLocalized(@"橡胶象枪"), KBLocalized(@"橡胶象枪乱打"), KBLocalized(@"橡胶灰熊铳"),
|
||||
KBLocalized(@"橡胶雷神象枪"), KBLocalized(@"橡胶猿王枪"), KBLocalized(@"橡胶犀·榴弹炮"), KBLocalized(@"橡胶大蛇炮"),
|
||||
KBLocalized(@"橡胶火箭"), KBLocalized(@"橡胶火箭炮"), KBLocalized(@"橡胶机关枪"), KBLocalized(@"橡胶子弹"),
|
||||
KBLocalized(@"橡胶攻城炮"), KBLocalized(@"橡胶象枪"), KBLocalized(@"橡胶象枪乱打"), KBLocalized(@"橡胶灰熊铳"),
|
||||
KBLocalized(@"橡胶雷神象枪"), KBLocalized(@"橡胶猿王枪"), KBLocalized(@"橡胶犀·榴弹炮"), KBLocalized(@"橡胶大蛇炮")].mutableCopy;
|
||||
}else if (index == 1) {
|
||||
list.dataSource = @[@"吃烤肉", @"吃鸡腿肉", @"吃牛肉", @"各种肉"].mutableCopy;
|
||||
list.dataSource = @[KBLocalized(@"吃烤肉"), KBLocalized(@"吃鸡腿肉"), KBLocalized(@"吃牛肉"), KBLocalized(@"各种肉")].mutableCopy;
|
||||
}else {
|
||||
list.dataSource = @[@"【剑士】罗罗诺亚·索隆", @"【航海士】娜美", @"【狙击手】乌索普", @"【厨师】香吉士", @"【船医】托尼托尼·乔巴", @"【船匠】 弗兰奇", @"【音乐家】布鲁克", @"【考古学家】妮可·罗宾"].mutableCopy;
|
||||
list.dataSource = @[KBLocalized(@"【剑士】罗罗诺亚·索隆"), KBLocalized(@"【航海士】娜美"), KBLocalized(@"【狙击手】乌索普"),
|
||||
KBLocalized(@"【厨师】香吉士"), KBLocalized(@"【船医】托尼托尼·乔巴"), KBLocalized(@"【船匠】 弗兰奇"),
|
||||
KBLocalized(@"【音乐家】布鲁克"), KBLocalized(@"【考古学家】妮可·罗宾")].mutableCopy;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
- (void)setupTextField {
|
||||
CGRect frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - 200)/2, ([UIScreen mainScreen].bounds.size.height - 200)/2, 200, 200);
|
||||
self.textView = [[UITextView alloc] initWithFrame:frame];
|
||||
self.textView.text = @"测试";
|
||||
self.textView.text = KBLocalized(@"测试");
|
||||
self.textView.layer.borderColor = [UIColor blackColor].CGColor;
|
||||
self.textView.layer.borderWidth = 0.5;
|
||||
[self.view addSubview:self.textView];
|
||||
|
||||
Reference in New Issue
Block a user