Files
keyboard/keyBoard/Class/Home/VC/HomeVC.m

112 lines
4.4 KiB
Mathematica
Raw Normal View History

2025-10-29 14:17:26 +08:00
//
// HomeVC.m
// keyBoard
//
// Created by Mac on 2025/10/29.
//
#import "HomeVC.h"
2025-10-29 16:26:57 +08:00
#import "KBGuideVC.h"
2025-11-03 16:37:28 +08:00
#import "KBLangTestVC.h"
2025-11-05 22:04:56 +08:00
#import "HomeSheetVC.h"
2025-10-29 14:17:26 +08:00
2025-11-03 16:37:28 +08:00
@interface HomeVC () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITextView *textView; //
2025-11-03 20:02:11 +08:00
@property (nonatomic, strong) BaseTableView *tableView; //
2025-11-03 16:37:28 +08:00
@property (nonatomic, copy) NSArray<NSString *> *items; //
2025-10-29 14:17:26 +08:00
@end
@implementation HomeVC
- (void)viewDidLoad {
[super viewDidLoad];
2025-10-29 14:28:57 +08:00
self.view.backgroundColor = [UIColor whiteColor];
2025-11-03 16:37:28 +08:00
2025-11-05 22:04:56 +08:00
// CGFloat width = [UIScreen mainScreen].bounds.size.width;
// UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 220)];
// CGRect frame = CGRectMake(16, 16, width - 32, 188);
// self.textView = [[UITextView alloc] initWithFrame:frame];
// self.textView.text = KBLocalized(@"home_input_placeholder");
// self.textView.layer.borderColor = [UIColor blackColor].CGColor;
// self.textView.layer.borderWidth = 0.5;
// [header addSubview:self.textView];
//
// //
// self.tableView = [[BaseTableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleInsetGrouped];
// self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
// self.tableView.delegate = self;
// self.tableView.dataSource = self;
// self.tableView.tableHeaderView = header;
// [self.view addSubview:self.tableView];
//
// self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), @"皮肤中心" ];
//
// dispatch_async(dispatch_get_main_queue(), ^{ [self.textView becomeFirstResponder]; });
//
// [[KBNetworkManager shared] GET:@"app/config" parameters:nil headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
// NSLog(@"====");
// }];
HomeSheetVC *vc = [HomeSheetVC new];
vc.minHeight = 300;
vc.topInset = 100;
[self presentPanModal:vc];
2025-10-29 14:17:26 +08:00
}
2025-11-03 15:04:19 +08:00
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
2025-11-05 22:04:56 +08:00
// self.title = KBLocalized(@"home_title");
// self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), @"皮肤中心" ];
// [self.tableView reloadData];
2025-11-03 15:04:19 +08:00
}
2025-10-29 16:26:57 +08:00
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
2025-10-29 19:13:35 +08:00
// KBGuideVC *vc = [[KBGuideVC alloc] init];
// [self.navigationController pushViewController:vc animated:true];
// [KBHUD showInfo:@"加载中..."];
2025-11-03 13:25:41 +08:00
// [KBHUD show];
// [KBHUD showAllowTapToDismiss:true];
2025-10-29 16:26:57 +08:00
}
2025-11-03 16:37:28 +08:00
#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.items.count; }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellId = @"home.cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; }
cell.textLabel.text = self.items[indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (indexPath.row == 0) {
//
KBLangTestVC *vc = [KBLangTestVC new];
[self.navigationController pushViewController:vc animated:YES];
2025-11-03 16:57:24 +08:00
} else if (indexPath.row == 1) {
//
KBGuideVC *vc = [KBGuideVC new];
[self.navigationController pushViewController:vc animated:YES];
2025-11-04 21:01:46 +08:00
} else if (indexPath.row == 2) {
//
UIViewController *vc = [NSClassFromString(@"KBSkinCenterVC") new];
if (vc) { [self.navigationController pushViewController:vc animated:YES]; }
2025-11-03 16:37:28 +08:00
}
}
2025-10-29 14:17:26 +08:00
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end