123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- //
- // MySetViewController.m
- // 双子星云手机
- //
- // Created by APPLE on 2023/8/17.
- //
- #import "MySetViewController.h"
- #import <SDWebImage.h>
- #import <Masonry.h>
- #import "UseAccountManage.h"
- #import "HelpDownScrollView.h"
- #import "MineViewCell.h"
- #import "ChangeLogoViewController.h"
- @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic, strong, nullable) UITableView *tableView;
- @end
- @implementation MySetViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- [self drawAnyView];
- }
- - (void)drawAnyView{
- [self.view setBackgroundColor:HWF5F7FAColor];
-
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
-
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- make.top.mas_equalTo(0);
- }];
-
- [self.tableView setTableHeaderView:[self headViewForTable]];
- }
- - (UIView *)headViewForTable{
- /*236顶部视图, 44中间试图下部分, 126下方视图*/
- UIView *headView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, 236.f + 44.f + 126))];
- [headView setBackgroundColor:[UIColor clearColor]];
-
- UIImage *bgImage = [UIImage imageNamed:@"set_up_bg"];
- // bgImage = [bgImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 40, 80)];
-
- UIImageView *bgImView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 236.f)];
- [bgImView setImage:bgImage];
- [headView addSubview:bgImView];
-
- /*头像*/
- UIImageView *photoImage = [[UIImageView alloc] init];
- [photoImage setImage:[UIImage imageNamed:@"photo_normal"]];
- [bgImView addSubview:photoImage];
- [photoImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(16.f);
- make.top.mas_equalTo(99.f);
- make.width.mas_equalTo(62.f);
- make.height.mas_equalTo(62.f);
- }];
-
- NSDictionary *loginInfo = [[UseAccountManage shareInstance] getLoginInfo];
- /*用户名*/
- UILabel *phoneLabel = [[UILabel alloc] init];
- [phoneLabel setFont:[UIFont boldSystemFontOfSize:18.f]];
- [phoneLabel setTextColor:[UIColor whiteColor]];
-
- if (loginInfo && [[loginInfo allKeys] containsObject:@"phone"]){
- [phoneLabel setText:[loginInfo objectForKey:@"phone"]];
- }
- [bgImView addSubview:phoneLabel];
- [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(photoImage.mas_right).offset(9);
- make.centerY.equalTo(photoImage.mas_centerY);
- make.right.mas_equalTo(-22.f);
- make.height.mas_equalTo(25.f);
- }];
-
- /*下方会员视图*/
- // vip_bg
- UIImageView *downBgView = [[UIImageView alloc] init];
- [downBgView setImage:[UIImage imageNamed:@"vip_bg"]];
- [headView addSubview:downBgView];
- [downBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15.f);
- make.right.mas_equalTo(-15.f);
- make.bottom.mas_equalTo(-126.f);
- make.height.mas_equalTo(96.f);
- }];
-
- /*VIP类型*/
- UILabel *vipType = [[UILabel alloc] init];
- [vipType setText:@"VIP"];
- [vipType setTextColor:[UIColor whiteColor]];
- [vipType setFont:[UIFont boldSystemFontOfSize:24.f]];
- [downBgView addSubview:vipType];
- [vipType mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(20.f);
- make.right.mas_equalTo(-100.f);
- make.top.mas_equalTo(18.f);
- make.height.mas_equalTo(33.f);
- }];
-
- /*VIP类型提示*/
- UILabel *vipTypeTipsLabel = [[UILabel alloc] init];
- [vipTypeTipsLabel setText:@"你当前为非会员,无法享受专属私密手机"];
- [vipTypeTipsLabel setTextColor:[UIColor whiteColor]];
- [vipTypeTipsLabel setFont:[UIFont systemFontOfSize:12.f]];
- [downBgView addSubview:vipTypeTipsLabel];
- [vipTypeTipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(20.f);
- make.right.mas_equalTo(-100.f);
- make.top.mas_equalTo(53.f);
- make.height.mas_equalTo(17.f);
- }];
-
- /*免费会员按钮*/
- UIButton *vipBtn = [[UIButton alloc] init];
- [vipBtn setBackgroundColor:[UIColor whiteColor]];
- [vipBtn setTitle:@"免费领会员" forState:(UIControlStateNormal)];
- [vipBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
- [vipBtn.titleLabel setFont:[UIFont systemFontOfSize:13.f]];
- [vipBtn.layer setCornerRadius:31.f/2.f];
- [downBgView addSubview:vipBtn];
- [vipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(86.f);
- make.right.mas_equalTo(-20.f);
- make.centerY.equalTo(downBgView.mas_centerY);
- make.height.mas_equalTo(31.f);
- }];
-
- /*下方视图*/
- HelpDownScrollView *helpDownScrollView = [[HelpDownScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W - 30, 96.f) withImageAry:@[@"icon-tubiao",@"icon-jincheng"] tilteAry:@[@"更换图标",@"进程隐藏"] numberOfLine:3];
- helpDownScrollView.presedDelegate = self;
- [headView addSubview:helpDownScrollView];
- [helpDownScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15.f);
- make.right.mas_equalTo(-15.f);
- make.bottom.mas_equalTo(-15.f);
- make.height.mas_equalTo(96.f);
- }];
- [helpDownScrollView setBackgroundColor:[UIColor whiteColor]];
- [helpDownScrollView.layer setCornerRadius:8.f];
-
- return headView;
- }
- /*
- #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.
- }
- */
- - (void)helpDownScrollViewBePressed:(nonnull id)sender withIndex:(NSInteger)index {
- HLog(@"\n----点击了第个%ld按钮----",index);
- if (index == 0){
- ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- }
- #pragma mark - 懒加载
- - (UITableView *)tableView{
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStyleGrouped];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.showsVerticalScrollIndicator = NO;
- _tableView.showsHorizontalScrollIndicator = NO;
- _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
- [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
- [_tableView setSeparatorColor:[UIColor clearColor]];
- [_tableView setBackgroundColor:[UIColor clearColor]];
- [_tableView setTableFooterView:[UIView new]];
- [_tableView setBounces:YES];
- if (@available(iOS 15.0, *)) {
- _tableView.sectionHeaderTopPadding = 0;
- }
- }
-
- return _tableView;
- }
- #pragma mark - 列表委托
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-
- return 5;
- }
- - (MineViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- NSInteger row = indexPath.row;
- static NSString *identifier = @"MineViewCell";
-
- MineViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- if (!cell){
- cell = [[MineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
- [cell setBackgroundColor:[UIColor clearColor]];
- [cell setAccessoryType:(UITableViewCellAccessoryNone)];
- }
- [cell.bgViewLayer removeFromSuperlayer];
- [cell.titleLabel2 setHidden:YES];
- [cell.rightImage setHidden:NO];
- [cell.lineView setHidden:NO];
- if (row == 0){
- [cell.titleLabel setText:@"邀请好友"];
- [cell.titleLabel2 setText:@"邀请好友送会员"];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-yaoqing"]];
- [cell.titleLabel2 setHidden:NO];
- /*上圆角*/
- //设置部分圆角 贝塞尔曲线
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
- byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
- cornerRadii:CGSizeMake(8, 8)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = cell.cellBgView.bounds;
- maskLayer.path = maskPath.CGPath;
- cell.bgViewLayer = maskLayer;
- cell.cellBgView.layer.mask = cell.bgViewLayer;
-
- }else if (row == 1){
- [cell.titleLabel setText:@"清除缓存"];
- [cell.titleLabel2 setText:@"0M"];
- [cell.titleLabel2 setHidden:NO];
- /*计算缓存大小*/
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-qingchu"]];
- }else if (row == 2){
- [cell.titleLabel setText:@"检测更新"];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-gengxin"]];
- }else if (row == 3){
- [cell.titleLabel setText:@"联系客服"];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-kefu"]];
- }else if (row == 4){
- [cell.titleLabel setText:@"退出账号"];
- [cell.mImageView setImage:[UIImage imageNamed:@"icon-tuichu"]];
- [cell.rightImage setHidden:YES];
- /*下圆角*/
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
- byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
- cornerRadii:CGSizeMake(8, 8)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = cell.cellBgView.bounds;
- maskLayer.path = maskPath.CGPath;
- cell.bgViewLayer = maskLayer;
- cell.cellBgView.layer.mask = cell.bgViewLayer;
-
- [cell.lineView setHidden:YES];
- }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 60;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
-
- NSInteger row = indexPath.row;
- }
- @end
|