新增页面

This commit is contained in:
2025-11-24 20:15:41 +08:00
parent 15e37841bb
commit 18df76a2b4
8 changed files with 347 additions and 8 deletions

View File

@@ -0,0 +1,16 @@
//
// KBFeedBackVC.h
// keyBoard
//
// Created by Mac on 2025/11/24.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface KBFeedBackVC : BaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,164 @@
#import "KBFeedBackVC.h"
#import <Masonry/Masonry.h>
@interface KBFeedBackVC () <UITextViewDelegate>
///
@property (nonatomic, strong) UIView *inputCardView;
///
@property (nonatomic, strong) UITextView *textView;
/// Please Enter The Content
@property (nonatomic, strong) UILabel *placeholderLabel;
/// 0/100
@property (nonatomic, strong) UILabel *countLabel;
///
@property (nonatomic, strong) UIButton *commitButton;
///
@property (nonatomic, assign) NSInteger maxCount;
@end
@implementation KBFeedBackVC
- (void)viewDidLoad {
[super viewDidLoad];
//
self.view.backgroundColor = [UIColor colorWithWhite:0.97 alpha:1.0];
self.kb_titleLabel.text = KBLocalized(@"Feedback");
self.maxCount = 100;
//
[self.view addSubview:self.inputCardView];
[self.inputCardView addSubview:self.textView];
[self.inputCardView addSubview:self.placeholderLabel];
[self.inputCardView addSubview:self.countLabel];
[self.view addSubview:self.commitButton];
//
[self.inputCardView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT + 16);
make.left.equalTo(self.view).offset(16);
make.right.equalTo(self.view).offset(-16);
make.height.mas_equalTo(220);
}];
//
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.inputCardView).offset(16);
make.left.equalTo(self.inputCardView).offset(16);
make.right.equalTo(self.inputCardView).offset(-16);
make.bottom.equalTo(self.inputCardView).offset(-32);
}];
// textView
[self.placeholderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.textView).offset(2);
make.left.equalTo(self.textView).offset(4);
}];
//
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.inputCardView).offset(-16);
make.bottom.equalTo(self.inputCardView).offset(-10);
}];
//
[self.commitButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(24);
make.right.equalTo(self.view).offset(-24);
make.bottom.equalTo(self.view).offset(-KB_SAFE_BOTTOM - 24);
make.height.mas_equalTo(56);
}];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self.view endEditing:true];
}
#pragma mark - Actions
///
- (void)onTapCommit {
NSString *content = self.textView.text ?: @"";
// TODO: +
}
#pragma mark - UITextViewDelegate
//
- (void)textViewDidChange:(UITextView *)textView {
//
if (textView.text.length > self.maxCount) {
textView.text = [textView.text substringToIndex:self.maxCount];
}
self.placeholderLabel.hidden = textView.text.length > 0;
self.countLabel.text = [NSString stringWithFormat:@"%ld/%ld",
(long)textView.text.length,
(long)self.maxCount];
}
#pragma mark - Lazy Load
- (UIView *)inputCardView {
if (!_inputCardView) {
_inputCardView = [UIView new];
_inputCardView.backgroundColor = [UIColor whiteColor];
_inputCardView.layer.cornerRadius = 16.0;
_inputCardView.layer.masksToBounds = YES;
}
return _inputCardView;
}
- (UITextView *)textView {
if (!_textView) {
_textView = [[UITextView alloc] init];
_textView.delegate = self;
_textView.backgroundColor = [UIColor clearColor];
_textView.font = [UIFont systemFontOfSize:16];
_textView.textColor = [UIColor blackColor];
_textView.textContainerInset = UIEdgeInsetsZero;
_textView.textContainer.lineFragmentPadding = 0;
_textView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
}
return _textView;
}
- (UILabel *)placeholderLabel {
if (!_placeholderLabel) {
_placeholderLabel = [UILabel new];
_placeholderLabel.textColor = [UIColor colorWithWhite:0.75 alpha:1.0];
_placeholderLabel.font = [UIFont systemFontOfSize:16];
_placeholderLabel.text = KBLocalized(@"Please Enter The Content");
}
return _placeholderLabel;
}
- (UILabel *)countLabel {
if (!_countLabel) {
_countLabel = [UILabel new];
_countLabel.textColor = [UIColor colorWithWhite:0.7 alpha:1.0];
_countLabel.font = [UIFont systemFontOfSize:14];
_countLabel.textAlignment = NSTextAlignmentRight;
_countLabel.text = @"0/100";
}
return _countLabel;
}
- (UIButton *)commitButton {
if (!_commitButton) {
_commitButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_commitButton setTitle:KBLocalized(@"Commit") forState:UIControlStateNormal];
[_commitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_commitButton.titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
// 使
_commitButton.backgroundColor = [UIColor colorWithRed:0.02 green:0.75 blue:0.67 alpha:1.0];
_commitButton.layer.cornerRadius = 28.0;
_commitButton.layer.masksToBounds = YES; //
[_commitButton addTarget:self action:@selector(onTapCommit) forControlEvents:UIControlEventTouchUpInside];
}
return _commitButton;
}
@end

View File

@@ -0,0 +1,16 @@
//
// KBNoticeVC.h
// keyBoard
//
// Created by Mac on 2025/11/24.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface KBNoticeVC : BaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,107 @@
#import "KBNoticeVC.h"
#import <Masonry/Masonry.h>
@interface KBNoticeVC ()
///
@property (nonatomic, strong) UIView *cardView;
/// Notification Setting
@property (nonatomic, strong) UILabel *noticeTitleLabel;
///
@property (nonatomic, strong) UISwitch *noticeSwitch;
@end
@implementation KBNoticeVC
- (void)viewDidLoad {
[super viewDidLoad];
//
self.view.backgroundColor = [UIColor colorWithHex:0xF8F8F8];
//
self.kb_titleLabel.text = KBLocalized(@"Notice");
//
[self.view addSubview:self.cardView];
[self.cardView addSubview:self.noticeTitleLabel];
[self.cardView addSubview:self.noticeSwitch];
//
[self.cardView mas_makeConstraints:^(MASConstraintMaker *make) {
//
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT + 16);
make.left.equalTo(self.view).offset(16);
make.right.equalTo(self.view).offset(-16);
make.height.mas_equalTo(64);
}];
//
[self.noticeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.cardView).offset(20);
make.centerY.equalTo(self.cardView);
}];
//
[self.noticeSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.cardView).offset(-20);
make.centerY.equalTo(self.cardView);
}];
}
#pragma mark - Actions
///
- (void)noticeSwitchChanged:(UISwitch *)sender {
BOOL isOn = sender.isOn;
// TODO: isOn
}
#pragma mark - Lazy Load
- (UIView *)cardView {
if (!_cardView) {
_cardView = [UIView new];
_cardView.backgroundColor = [UIColor whiteColor];
_cardView.layer.cornerRadius = 16.0;
_cardView.layer.masksToBounds = NO;
// 稿
_cardView.layer.shadowColor = [UIColor colorWithWhite:0 alpha:0.06].CGColor;
_cardView.layer.shadowOpacity = 1.0;
_cardView.layer.shadowOffset = CGSizeMake(0, 4);
_cardView.layer.shadowRadius = 8.0;
}
return _cardView;
}
- (UILabel *)noticeTitleLabel {
if (!_noticeTitleLabel) {
_noticeTitleLabel = [UILabel new];
_noticeTitleLabel.textColor = [UIColor blackColor];
_noticeTitleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
// Localizable.strings
_noticeTitleLabel.text = KBLocalized(@"Notification Setting");
}
return _noticeTitleLabel;
}
- (UISwitch *)noticeSwitch {
if (!_noticeSwitch) {
_noticeSwitch = [[UISwitch alloc] init];
_noticeSwitch.on = YES;
//
if (@available(iOS 13.0, *)) {
_noticeSwitch.onTintColor = [UIColor systemGreenColor];
} else {
_noticeSwitch.onTintColor = [UIColor colorWithRed:76/255.0
green:217/255.0
blue:100/255.0
alpha:1.0];
}
//
[_noticeSwitch addTarget:self
action:@selector(noticeSwitchChanged:)
forControlEvents:UIControlEventValueChanged];
}
return _noticeSwitch;
}
@end

View File

@@ -11,6 +11,8 @@
#import "KBMyHeaderView.h" //
#import "KBMyListCell.h"
#import "KBTestVC.h"
#import "KBNoticeVC.h"
#import "KBFeedBackVC.h"
@interface MyVC () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) BaseTableView *tableView; //
@@ -35,12 +37,12 @@
// title + SF Symbols +
self.data = @[
@[@{ @"title": KBLocalized(@"Notice"), @"icon": @"my_notice_icon", @"color": @(0x60A3FF) }],
@[@{ @"title": KBLocalized(@"Share App"), @"icon": @"my_share_icon", @"color": @(0xF5A623) }],
@[@{ @"title": KBLocalized(@"Feedback"), @"icon": @"my_feedback_icon", @"color": @(0xB06AFD) },
@{ @"title": KBLocalized(@"E-mail"), @"icon": @"my_email_icon", @"color": @(0xFF8A65) },
@{ @"title": KBLocalized(@"Agreement"), @"icon": @"my_agreement_icon", @"color": @(0x4CD964) },
@{ @"title": KBLocalized(@"Privacy Policy"), @"icon": @"my_privacy_icon", @"color": @(0x5AC8FA) }]
@[@{ @"title": KBLocalized(@"Notice"), @"icon": @"my_notice_icon", @"color": @(0x60A3FF),@"id":@"1" }],
@[@{ @"title": KBLocalized(@"Share App"), @"icon": @"my_share_icon", @"color": @(0xF5A623),@"id":@"2" }],
@[@{ @"title": KBLocalized(@"Feedback"), @"icon": @"my_feedback_icon", @"color": @(0xB06AFD),@"id":@"3" },
@{ @"title": KBLocalized(@"E-mail"), @"icon": @"my_email_icon", @"color": @(0xFF8A65),@"id":@"4" },
@{ @"title": KBLocalized(@"Agreement"), @"icon": @"my_agreement_icon", @"color": @(0x4CD964),@"id":@"5" },
@{ @"title": KBLocalized(@"Privacy Policy"), @"icon": @"my_privacy_icon", @"color": @(0x5AC8FA),@"id":@"6" }]
];
[self.view addSubview:self.tableView];
@@ -93,8 +95,25 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
KBTestVC *vc = [[KBTestVC alloc] init];
[self.navigationController pushViewController:vc animated:true];
NSDictionary *info = self.data[indexPath.section][indexPath.row];
NSString *itemID = info[@"id"];
if ([itemID isEqualToString:@"1"]) {
[self.navigationController pushViewController:[KBNoticeVC new] animated:true];
}else if ([itemID isEqualToString:@"2"]){
}else if ([itemID isEqualToString:@"3"]){
[self.navigationController pushViewController:[KBFeedBackVC new] animated:true];
}else if ([itemID isEqualToString:@"4"]){
}else if ([itemID isEqualToString:@"5"]){
}else if ([itemID isEqualToString:@"6"]){
}
// KBTestVC *vc = [[KBTestVC alloc] init];
// [self.navigationController pushViewController:vc animated:true];
}
#pragma mark - Lazy