2025-10-29 14:17:26 +08:00
|
|
|
|
//
|
|
|
|
|
|
// MyVC.m
|
|
|
|
|
|
// keyBoard
|
|
|
|
|
|
//
|
|
|
|
|
|
// Created by Mac on 2025/10/29.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import "MyVC.h"
|
2025-11-08 21:44:41 +08:00
|
|
|
|
#import "MySkinVC.h"
|
2025-11-08 22:25:57 +08:00
|
|
|
|
#import "KBSkinDetailVC.h"
|
2025-11-10 19:22:31 +08:00
|
|
|
|
#import "KBMyHeaderView.h" // 顶部视图独立封装
|
|
|
|
|
|
#import "KBMyListCell.h"
|
2025-11-10 20:40:11 +08:00
|
|
|
|
#import "KBMyKeyBoardVC.h"
|
2025-10-29 14:17:26 +08:00
|
|
|
|
|
2025-11-10 19:22:31 +08:00
|
|
|
|
@interface MyVC () <UITableViewDelegate, UITableViewDataSource>
|
|
|
|
|
|
@property (nonatomic, strong) BaseTableView *tableView; // 列表
|
|
|
|
|
|
@property (nonatomic, strong) KBMyHeaderView *header; // 顶部视图
|
|
|
|
|
|
@property (nonatomic, strong) NSArray<NSArray<NSDictionary *> *> *data; // 分组数据
|
2025-11-10 19:55:50 +08:00
|
|
|
|
@property (nonatomic, strong) UIImageView *bgImageView; // 全屏背景图
|
2025-10-29 14:17:26 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@implementation MyVC
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
|
|
[super viewDidLoad];
|
2025-11-10 19:55:50 +08:00
|
|
|
|
// 背景图
|
|
|
|
|
|
self.view.backgroundColor = UIColor.clearColor;
|
|
|
|
|
|
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my_bg_icon"]];
|
|
|
|
|
|
self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
|
|
|
[self.view addSubview:self.bgImageView];
|
|
|
|
|
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
make.edges.equalTo(self.view);
|
|
|
|
|
|
}];
|
2025-11-10 19:22:31 +08:00
|
|
|
|
|
|
|
|
|
|
// 数据源(title + SF Symbols 名称 + 色值),分两组
|
|
|
|
|
|
self.data = @[
|
|
|
|
|
|
@[@{ @"title": @"Notice", @"icon": @"my_notice_icon", @"color": @(0x60A3FF) }],
|
|
|
|
|
|
@[@{ @"title": @"Share App", @"icon": @"my_share_icon", @"color": @(0xF5A623) }],
|
|
|
|
|
|
@[@{ @"title": @"Feedback", @"icon": @"my_feedback_icon", @"color": @(0xB06AFD) },
|
|
|
|
|
|
@{ @"title": @"E-mail", @"icon": @"my_email_icon", @"color": @(0xFF8A65) },
|
|
|
|
|
|
@{ @"title": @"Agreement", @"icon": @"my_agreement_icon", @"color": @(0x4CD964) },
|
|
|
|
|
|
@{ @"title": @"Privacy Policy", @"icon": @"my_privacy_icon", @"color": @(0x5AC8FA) }]
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
[self.view addSubview:self.tableView];
|
|
|
|
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
make.edges.equalTo(self.view);
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
// tableHeaderView 需要设置 frame,约束不会自动生效
|
|
|
|
|
|
self.header = [[KBMyHeaderView alloc] initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, 357)];
|
2025-11-10 19:55:50 +08:00
|
|
|
|
self.header.backgroundColor = UIColor.clearColor; // 透明,显示背景图
|
2025-11-10 19:22:31 +08:00
|
|
|
|
self.tableView.tableHeaderView = self.header;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated{
|
|
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
|
|
[self.navigationController setNavigationBarHidden:YES animated:animated];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated{
|
|
|
|
|
|
[super viewWillDisappear:animated];
|
|
|
|
|
|
[self.navigationController setNavigationBarHidden:NO animated:animated];
|
|
|
|
|
|
|
2025-10-29 14:17:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-10 19:22:31 +08:00
|
|
|
|
#pragma mark - UITableView
|
2025-11-08 22:25:57 +08:00
|
|
|
|
|
2025-11-10 19:22:31 +08:00
|
|
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return self.data.count; }
|
|
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.data[section].count; }
|
|
|
|
|
|
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return CGFLOAT_MIN; }
|
|
|
|
|
|
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
|
|
|
|
|
UIView *v = [UIView new]; v.backgroundColor = [UIColor clearColor]; return v;
|
2025-10-29 19:13:35 +08:00
|
|
|
|
}
|
2025-11-10 19:22:31 +08:00
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { return 20; }
|
|
|
|
|
|
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { UIView *v = [UIView new]; v.backgroundColor = UIColor.clearColor; return v; }
|
|
|
|
|
|
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 64; }
|
|
|
|
|
|
|
|
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
KBMyListCell *cell = [tableView dequeueReusableCellWithIdentifier:[KBMyListCell reuseId]];
|
|
|
|
|
|
if (!cell) { cell = [[KBMyListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[KBMyListCell reuseId]]; }
|
|
|
|
|
|
|
|
|
|
|
|
NSDictionary *info = self.data[indexPath.section][indexPath.row];
|
|
|
|
|
|
cell.itemInfoDic = info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 卡片圆角(每个 section 四周 8 的圆角)
|
|
|
|
|
|
NSInteger rows = [tableView numberOfRowsInSection:indexPath.section];
|
|
|
|
|
|
BOOL isFirst = indexPath.row == 0;
|
|
|
|
|
|
BOOL isLast = indexPath.row == rows - 1;
|
|
|
|
|
|
[cell applyCornersWithFirst:isFirst last:isLast];
|
2025-10-29 19:13:35 +08:00
|
|
|
|
|
2025-11-10 19:22:31 +08:00
|
|
|
|
// 分割线:仅上面一组显示中间线;下面一组完全不显示
|
|
|
|
|
|
BOOL showLine = (indexPath.section == 0) && !isLast;
|
|
|
|
|
|
[cell setLineHidden:!showLine];
|
|
|
|
|
|
|
|
|
|
|
|
return cell;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
2025-11-10 20:40:11 +08:00
|
|
|
|
KBMyKeyBoardVC *vc = [[KBMyKeyBoardVC alloc] init];
|
|
|
|
|
|
[self.navigationController pushViewController:vc animated:true];
|
2025-11-10 19:22:31 +08:00
|
|
|
|
}
|
2025-10-29 14:17:26 +08:00
|
|
|
|
|
2025-11-10 19:22:31 +08:00
|
|
|
|
#pragma mark - Lazy
|
|
|
|
|
|
- (BaseTableView *)tableView {
|
|
|
|
|
|
if (!_tableView) {
|
|
|
|
|
|
_tableView = [[BaseTableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
2025-11-10 19:55:50 +08:00
|
|
|
|
_tableView.backgroundColor = UIColor.clearColor; // 透明
|
|
|
|
|
|
_tableView.opaque = NO;
|
2025-11-10 19:22:31 +08:00
|
|
|
|
_tableView.delegate = self;
|
|
|
|
|
|
_tableView.dataSource = self;
|
|
|
|
|
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // 关闭系统分割线
|
|
|
|
|
|
}
|
|
|
|
|
|
return _tableView;
|
2025-10-29 14:17:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|