Commit 69ff8776 by xuning

设置

parent f3faef41
{
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "chevron_right@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -12,7 +12,6 @@
#import "XVNewJobViewController.h"
#import "XVOrderSortView.h"
#import "XVPersonalViewController.h"
#import <UIViewController+CWLateralSlide.h>
#import <TXScrollLabelView.h>
#import "WMDragView.h"
#import "XVOrderSearchView.h"
......
......@@ -7,11 +7,10 @@
//
#import "XVPersonalViewController.h"
#import "XVPersonalViewCell.h"
#import "XVPersonalHeaderView.h"
#import "XVPersonalFooterView.h"
#import <SDCycleScrollView/SDCycleScrollView.h>
#import "XVVerticalButton.h"
#import "XVSettingViewController.h"
@interface XVPersonalViewController ()
......@@ -285,7 +284,13 @@
- (UIButton *)settingButton {
if (_settingButton == nil) {
_settingButton = [[UIButton alloc]initWithNormalImageName:@"riLine-settings-line 1" selectedImgName:@"riLine-settings-line 1"];
WS(weakSelf)
[_settingButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) {
XVSettingViewController *settingVc = [[XVSettingViewController alloc]init];
[weakSelf cw_pushViewController:settingVc];
}];
}
return _settingButton;
}
- (UIScrollView *)scrollView {
......
//
// XVPersonalViewCell.h
// XVSettingViewController.h
// fastservice
//
// Created by xuning on 2/7/24.
// Copyright © 2024 FastService. All rights reserved.
// Created by xuning on 4/27/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "XVBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XVPersonalViewCell : UITableViewCell
@property (nonatomic, strong) NSDictionary *item;
@interface XVSettingViewController : XVBaseViewController
@end
......
//
// XVSettingViewController.m
// fastservice
//
// Created by xuning on 4/27/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "XVSettingViewController.h"
#import "XVSettingTableViewCell.h"
@interface XVSettingViewController ()
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray<NSArray *> *dataArray;
@property (nonatomic, strong) UIButton *logoutButton;
@property (nonatomic, strong) UIButton *versionButton;
@end
@implementation XVSettingViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"设置";
[self setupUI];
}
- (void)setupUI {
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(UIEdgeInsetsMake(0, 7, 0, 7));
}];
}
#pragma mark - TableViewDelegate & Datasource
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
CGFloat cornerRadius =10.0;
CGRect bounds = cell.bounds;
// 每区行数
NSInteger numberOfRows = [tableView numberOfRowsInSection:indexPath.section];
//绘制曲线
UIBezierPath *bezierPath = nil;
if (indexPath.row == 0 && numberOfRows == 1) {
//四个角都为圆角
bezierPath = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
} else if (indexPath.row == 0) {
// cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width);
//左上、右上角为圆角
bezierPath = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
} else if (indexPath.row == numberOfRows - 1) {
// cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width);
//某个区的最后一行:左下、右下角为圆角
bezierPath = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:(UIRectCornerBottomLeft|UIRectCornerBottomRight) cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
} else {
//某个区的中间行:为矩形
bezierPath = [UIBezierPath bezierPathWithRect:bounds];
}
cell.backgroundColor = [UIColor clearColor];
//新建一个layer层,设置填充色和边框颜色
CAShapeLayer *layer = [CAShapeLayer layer];
layer.path = bezierPath.CGPath;
layer.fillColor = [UIColor whiteColor].CGColor;
layer.strokeColor = [UIColor whiteColor].CGColor;
//将layer层添加到cell.layer中,并插到最底层
[cell.layer insertSublayer:layer atIndex:0];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.dataArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray[section].count;
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSDictionary *dict = self.dataArray[indexPath.section][indexPath.row];
XVSettingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"XVSettingViewController"];
cell.dict = dict;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0 && indexPath.row == 0) {
return 80;
}
return 44;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 8;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
if (section == 3) {
return 114;
}
return CGFLOAT_MIN;
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return [UIView new];
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
if (section == 3) {
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.tableView.width, 114)];
[view addSubview:self.logoutButton];
self.logoutButton.frame = CGRectMake(0, 20, self.tableView.width, 44);
[view addSubview:self.versionButton];
self.versionButton.frame = CGRectMake(0, 97, self.tableView.width, 17);
return view;
}
return [UIView new];
}
- (UITableView *)tableView {
if (_tableView == nil) {
_tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.backgroundColor = DEFAULT_BACKGROUND_COLOR;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; //设置分割线的分割
[_tableView registerClass:[XVSettingTableViewCell class] forCellReuseIdentifier:@"XVSettingViewController"];
}
return _tableView;
}
- (NSMutableArray *)dataArray {
if (_dataArray == nil) {
_dataArray = [NSMutableArray arrayWithCapacity:4];
[_dataArray addObject:@[
@{@"title":@"头像",@"type":@(1)},
@{@"title":@"姓名",@"type":@(2)},
@{@"title":@"昵称",@"type":@(3)},
@{@"title":@"性别",@"type":@(4)}]];
[_dataArray addObject:@[
@{@"title":@"更换手机号",@"type":@(4)},
@{@"title":@"修改密码",@"type":@(4)}]];
[_dataArray addObject:@[
@{@"title":@"清除缓存",@"type":@(4)},
@{@"title":@"关于快服务骑士",@"type":@(4)}]];
[_dataArray addObject:@[
@{@"title":@"账号注销",@"type":@(4)}]];
}
return _dataArray;
}
- (UIButton *)logoutButton {
if (_logoutButton == nil) {
_logoutButton = [[UIButton alloc]initWithTitle:@"退出登录" fontSize:14 titleColor:[UIColor whiteColor] bgColor:COLOR_THEMEGRENN];
}
return _logoutButton;
}
- (UIButton *)versionButton {
if(_versionButton == nil) {
_versionButton = [[UIButton alloc]initWithTitle:S(@"当前版本号:%@(Build %@)",APP_VERSION,APP_BUILD) fontSize:12 titleColor:F_606060_COLOR bgColor:nil];
}
return _versionButton;
}
@end
//
// XVPersonalFooterView.m
// fastservice
//
// Created by xuning on 2/8/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVPersonalFooterView.h"
@interface XVPersonalFooterView()
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIImageView *serviceImageView;
@property (nonatomic, strong) UILabel *serviceLabel;
@end
@implementation XVPersonalFooterView
- (instancetype)initWithFrame:(CGRect)frame {
if(self = [super initWithFrame:frame]) {
[self setupUI];
}
return self;
}
- (void)setupUI {
[self addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self).mas_offset(-27);
make.top.mas_equalTo(self).mas_offset(21);
make.size.mas_equalTo(CGSizeMake(64, 64));
}];
[self.bgView addSubview:self.serviceImageView];
[self.serviceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.bgView);
make.size.mas_equalTo(CGSizeMake(45, 45));
}];
kViewBorderRadius(self.bgView, 32, 0, [UIColor clearColor]);
[self addSubview:self.serviceLabel];
[self.serviceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgView);
make.top.mas_equalTo(self.serviceImageView.mas_bottom).mas_offset(9);
}];
}
- (UIView *)bgView {
if(_bgView == nil) {
_bgView = [[UIView alloc]init];
_bgView.backgroundColor = kHexRGB(0xF0EFEF);
}
return _bgView;
}
- (UIImageView *)serviceImageView {
if(_serviceImageView == nil) {
_serviceImageView = [[UIImageView alloc]initWithImageName:@"if-live-support"];
_serviceImageView.backgroundColor = kHexRGB(0xF0EFEF);
}
return _serviceImageView;
}
- (UILabel *)serviceLabel {
if(_serviceLabel == nil) {
_serviceLabel = [[UILabel alloc]initWithText:@"联系客服" textColor:F_101010_COLOR textAlignment:(NSTextAlignmentCenter) fontSize:14];
}
return _serviceLabel;
}
@end
//
// XVPersonalViewCell.m
// fastservice
//
// Created by xuning on 2/7/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVPersonalViewCell.h"
@interface XVPersonalViewCell()
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *arrowImageViiew;
@property (nonatomic, strong) UIView *lineView;
@end
@implementation XVPersonalViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self setupUI];
}
return self;
}
- (void)setupUI {
[self.contentView addSubview:self.iconImageView];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.contentView).mas_offset(17);
make.size.mas_equalTo(CGSizeMake(24, 24));
}];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.iconImageView.mas_right).mas_offset(9);
}];
[self.contentView addSubview:self.arrowImageViiew];
[self.arrowImageViiew mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.contentView).mas_offset(-19);
make.size.mas_equalTo(CGSizeMake(17, 17));
}];
[self.contentView addSubview:self.lineView];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.contentView);
make.height.mas_equalTo(1);
}];
}
- (void)setItem:(NSDictionary *)item {
_item = item;
self.iconImageView.image = IMG(item[@"imageName"]);
self.titleLabel.text = item[@"title"];
}
- (UIImageView *)iconImageView {
if(_iconImageView == nil) {
_iconImageView = [[UIImageView alloc]initWithImageName:@"ze-pending-payment"];
}
return _iconImageView;
}
- (UILabel *)titleLabel {
if(_titleLabel == nil) {
_titleLabel = [[UILabel alloc]initWithText:@"标题" textColor:F_101010_COLOR textAlignment:(NSTextAlignmentLeft) fontSize:14];
}
return _titleLabel;
}
- (UIImageView *)arrowImageViiew {
if(_arrowImageViiew == nil) {
_arrowImageViiew = [[UIImageView alloc]initWithImageName:@"antOutline-right"];
}
return _arrowImageViiew;
}
- (UIView *)lineView {
if(_lineView == nil) {
_lineView = [[UIView alloc]init];
_lineView.backgroundColor = DEFAULT_BACKGROUND_COLOR;
}
return _lineView;
}
@end
//
// XVPersonalFooterView.h
// XVSettingTableViewCell.h
// fastservice
//
// Created by xuning on 2/8/24.
// Copyright © 2024 FastService. All rights reserved.
// Created by xuning on 4/27/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XVPersonalFooterView : UIView
@interface XVSettingTableViewCell : UITableViewCell
@property (nonatomic, strong) NSDictionary *dict;
@end
......
//
// XVSettingTableViewCell.m
// fastservice
//
// Created by xuning on 4/27/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "XVSettingTableViewCell.h"
@interface XVSettingTableViewCell()
@property (nonatomic, strong) UIView *lineView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *userImageView;
@property (nonatomic, strong) UIImageView *idImageView;
@property (nonatomic, strong) UILabel *subTitleLabel;
@property (nonatomic, strong) UIImageView *arrowImageView;
@end
@implementation XVSettingTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self setupUI];
}
return self;
}
- (void)setDict:(NSDictionary *)dict {
int type = [dict[@"type"] intValue];
if (type == 1) {
[self.contentView addSubview:self.userImageView];
[self.userImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(66, 66));
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.contentView).mas_offset(-13);
}];
}else if(type == 2) {
[self.contentView addSubview:self.idImageView];
[self.idImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(47, 47));
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.contentView).mas_offset(-13);
}];
[self.contentView addSubview:self.subTitleLabel];
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.idImageView.mas_left).mas_offset(-7);
}];
}else if( type == 3 || type == 4) {
[self.contentView addSubview:self.subTitleLabel];
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.contentView.mas_left).mas_offset(-38);
}];
if ( type == 4) {
[self.contentView addSubview:self.arrowImageView];
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(20, 20));
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.contentView).mas_offset(-5);
}];
}
}
}
- (void)setupUI {
[self.contentView addSubview:self.lineView];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contentView).mas_offset(15);
make.right.mas_equalTo(self.contentView).mas_offset(-15);
make.bottom.mas_equalTo(self.contentView);
make.height.mas_equalTo(1);
}];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contentView).mas_offset(15);
make.centerY.mas_equalTo(self.contentView);
}];
}
- (UIView *)lineView {
if (_lineView == nil) {
_lineView = [[UIView alloc]init];
_lineView.backgroundColor = F7_3_COLOR;
}
return _lineView;
}
- (UILabel *)titleLabel {
if(_titleLabel == nil) {
_titleLabel = [[UILabel alloc]initWithText:@"标题" textColor:F_606060_COLOR textAlignment:(NSTextAlignmentLeft) fontSize:14];
}
return _titleLabel;
}
- (UIImageView *)userImageView {
if(_userImageView == nil) {
_userImageView = [[UIImageView alloc]initWithImageName:@"qishi-head"];
}
return _userImageView;
}
- (UIImageView *)idImageView {
if (_idImageView == nil) {
_idImageView = [[UIImageView alloc]initWithImageName:@"图标 15"];
}
return _idImageView;
}
- (UILabel *)subTitleLabel {
if(_subTitleLabel == nil) {
_subTitleLabel = [[UILabel alloc]initWithText:@"标题" textColor:F_101010_COLOR textAlignment:(NSTextAlignmentRight) fontSize:14];
}
return _subTitleLabel;
}
- (UIImageView *)arrowImageView {
if (_arrowImageView == nil) {
_arrowImageView = [[UIImageView alloc]initWithImageName:@"chevron_right"];
}
return _arrowImageView;
}
@end
......@@ -22,7 +22,7 @@
#import "UINavigation+SXFixSpace.h"
#import "UIBarButtonItem+SXCreate.h"
#import <UIViewController+CWLateralSlide.h>
//#import<BMKLocationKit/BMKLocationComponent.h>
......@@ -48,6 +48,7 @@
#endif
#define IMG(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]
#define S(str,...) [NSString stringWithFormat:str,##__VA_ARGS__]
#define RGBAColor(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define kHexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
......@@ -104,6 +105,12 @@
//整个顶部的高度
#define KTOP_HEIGHT (KSTATUSBAR_HEIGHT + KNAVBAR_HEIGHT)
//app 版本
#define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
#define APP_BUILD [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
#define IS_IPHONEX ({\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment