| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- // MineViewController.m
- // AICity
- //
- // Created by 刘伟伟 on 2023/7/7.
- // Copyright © 2023 wei.z. All rights reserved.
- //
- #import "AccountCenterViewController.h"
- #import "FavViewController.h"
- #import "PlayHistoryViewController.h"
- #import "CommonBarView.h"
- #import "DelAccountViewController.h"
- #import "LoginWithPassViewController.h"
- #import "AppDelegate.h"
- @interface AccountCenterViewController ()<UITableViewDelegate,UITableViewDataSource>
- @property(nonatomic,strong)UITableView *tableView;
- @property(nonatomic,strong)NSArray *imagesName;
- @property(nonatomic,strong)NSArray *titName;
- @property(nonatomic,strong)CommonBarView *customerbar;
- @end
- @implementation AccountCenterViewController
- -(UIStatusBarStyle)preferredStatusBarStyle{
- return UIStatusBarStyleLightContent;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.view.backgroundColor = rgba(18, 23, 41, 1);
- self.fd_prefersNavigationBarHidden = true;
- self.imagesName = @[@"Frame 9353",@"Frame 9355",@"Frame 9359",@"Frame 9363",@"Frame 9365",@"Frame 9371"];
- self.titName = @[@"我的收藏",@"账号中心",@"用户协议",@"隐私政策",@"去评分鼓励我们",@"当前版本"];
- // Do any additional setup after loading the view.
- [self.view addSubview:self.customerbar];
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.customerbar.mas_bottom);
- make.left.right.bottom.equalTo(self.view);
- }];
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- return 12;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- if(indexPath.row==0){
- return 50;
- }else{
- return 62;
- }
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return 0.01;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return 2;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- if(indexPath.row == 0){
- DelAccountViewController *vc = [DelAccountViewController new];
- [self.navigationController pushViewController:vc animated:true];
- }else if(indexPath.row == 1) {
-
- //清理token
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"existUserData"];
-
- //清理我的收藏
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"mycollectlist"];
- //清理历史播放记录
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"myhistoryplaylist"];
- //清理搜索历史
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"mylocationhistory"];
- //清理历史播放进度
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"playProcessData"];
-
- AppDelegate *myDelegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
- LoginWithPassViewController * vc = [[LoginWithPassViewController alloc] init];
- myDelegate.window.rootViewController = vc;
- }
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- if(indexPath.row == 0){
- AccountCenterCell *cell = [AccountCenterCell cellWithTableView:tableView];
- cell.type = 3;//0.没有 1.上 2.下 3.全
- cell.showContentType = 0;//0 剪头 1 文字
- // cell.icon.image = [UIImage imageNamed:@"Frame 9370"];
- cell.tit.text=@"注销账号";
- return cell;
- }else{
- UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCellStyleDefault001"];
- cell.backgroundColor = [UIColor clearColor];
- UILabel *lab = [UILabel new];
- lab.text = @"退出登录";
- lab.font = [UIFont systemFontOfSize:16];
- lab.textColor = rgba(255, 255, 255, 0.8);
- lab.textAlignment = NSTextAlignmentCenter;
- [cell.contentView addSubview:lab];
- lab.backgroundColor = rgba(27, 31, 48, 1);
- [lab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(cell.contentView).offset(12);
- make.right.equalTo(cell.contentView).offset(-12);
- make.bottom.equalTo(cell.contentView);
- make.height.mas_equalTo(@50);
- }];
- lab.layer.cornerRadius = 12;
- lab.layer.masksToBounds = true;
- return cell;
- }
-
- // MineCenterCell *cell = [MineCenterCell cellWithTableView:tableView];
- // if(indexPath.row == 0){
- // cell.type = 1;
- // cell.showContentType = 0;
- // }else if(indexPath.row == 5){
- // cell.type = 2;
- // cell.showContentType = 1;
- // }else{
- // cell.type = 0;
- // cell.showContentType = 0;
- // }
- // cell.icon.image = [UIImage imageNamed:self.imagesName[indexPath.row]];
- // cell.tit.text = self.titName[indexPath.row];
- // return cell;
-
- }
- -(UITableView *)tableView{
- if(!_tableView){
- _tableView =[[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- _tableView.showsVerticalScrollIndicator = false;
- _tableView.showsHorizontalScrollIndicator = false;
- _tableView.backgroundColor = rgba(18, 23, 41, 1);//rgba(18, 23, 41, 1);
- // _tableView.backgroundColor = [UIColor redColor];
- if (@available(iOS 11, *)) {
- _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- _tableView.estimatedRowHeight = 0;
- _tableView.estimatedSectionFooterHeight = 0;
- _tableView.estimatedSectionHeaderHeight = 0;
-
- // UIWindow *keyWindow = UIApplication.sharedApplication.keyWindow;
- // UIEdgeInsets safeAreaInsets = keyWindow.safeAreaInsets;
- // CGFloat topSafeArea = safeAreaInsets.top;
- _tableView.contentInset = UIEdgeInsetsMake(24, 0, BAR_HEIGHT, 0);
- // _tableView2.contentInset = UIEdgeInsetsMake(-35, 0, 0, 0);
- }
- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 // only Xcode 13+ needs and can compile this
- if (@available(iOS 15.0, *)) {
- _tableView.sectionHeaderTopPadding = 0;
- }
- #endif
- }
- return _tableView;
- }
- -(CommonBarView *)customerbar{
- if(!_customerbar){
- CGFloat h=0;
- if(@available(iOS 13.0, *)){
- UIStatusBarManager *sc= [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager;
- CGRect f=sc.statusBarFrame;
- h=f.size.height;
- }else{
- h=[UIApplication sharedApplication].statusBarFrame.size.height;
- }
- if(h>=40){
- h=30;
- }
- _customerbar =[[CommonBarView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 72-20+h)];
- _customerbar.bgView.backgroundColor = [UIColor clearColor];
- _customerbar.label.text=@"账号安全中心";
- _customerbar.bgView.alpha = 1;
- _customerbar.label.textColor = rgba(255, 255, 255, 1);
- // _customerbar.leftButton.hidden = true;
- // [_customerbar.leftButton setImage:[UIImage imageNamed:@"his_back"] forState:UIControlStateNormal];
- [_customerbar.rightButton setImage:[UIImage imageNamed:@"Frame 9411"] forState:UIControlStateNormal];
- [_customerbar.rightButton setTitle:@"编辑" forState:UIControlStateNormal];
- // [_customerbar.rightButton setImage:[self imageWithColor:[UIColor clearColor]] forState:UIControlStateSelected];
- [_customerbar.rightButton setTitle:@"取消" forState:UIControlStateSelected];
- [_customerbar.rightButton setTitleColor:rgba(255, 255, 255, 1) forState:UIControlStateNormal];
- _customerbar.rightButton.titleLabel.font =[UIFont systemFontOfSize:14];
- _customerbar.rightButton.hidden = true;
- [_customerbar.leftButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
- // [_customerbar.rightButton addTarget:self action:@selector(changeSelState:) forControlEvents:UIControlEventTouchUpInside];
- // [_customerbar.rightButton addTarget:self action:@selector(shareAction) forControlEvents:UIControlEventTouchUpInside];
- // [_customerbar.rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(_customerbar.leftButton);
- // make.right.equalTo(_customerbar).offset(-15);
- // make.size.mas_equalTo(CGSizeMake(23, 23));
- // }];
- }
- return _customerbar;
- }
- -(void)backAction{
- [self.navigationController popViewControllerAnimated:true];
- }
- @end
- @implementation AccountTopCell
- + (instancetype)cellWithTableView:(UITableView *)tableView{
- static NSString *identifier = @"AccountTopCell";
- AccountTopCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
- if (cell == nil) {
- cell = [[AccountTopCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
- }
-
- return cell;
- }
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- [self creatView];
- }
- return self;
- }
- -(void)creatView{
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
- UIImageView *bigimage=[UIImageView new];
- bigimage.image = [UIImage imageNamed:@"Ellipse 128"];
- [self.contentView addSubview:bigimage];
- [bigimage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(60, 60));
- make.left.equalTo(self.contentView).offset(20);
- make.top.equalTo(self.contentView);
- }];
-
- UIImageView *smallimage=[UIImageView new];
- smallimage.image = [UIImage imageNamed:@"Frame 1"];
- [bigimage addSubview:smallimage];
- [smallimage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(36, 36));
- make.center.equalTo(bigimage);
- }];
-
- UILabel *name = [UILabel new];
- name.font = [UIFont systemFontOfSize:20];
- name.text = @"登录/注册";
- name.textColor = rgba(255, 255, 255, 1);
- [self.contentView addSubview:name];
- [name mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(bigimage).offset(5);
- make.left.equalTo(bigimage.mas_right).offset(12);
- }];
-
-
- UILabel *welcome = [UILabel new];
- welcome.font = [UIFont systemFontOfSize:14];
- welcome.text = @"Hi,欢迎来到快影";
- welcome.textColor = rgba(246, 234, 167, 0.6);
- [self.contentView addSubview:welcome];
- [welcome mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(name.mas_bottom).offset(6);
- make.left.equalTo(name);
- }];
-
- // CGFloat top = 10; // 拉伸区域距离顶端高度
- // CGFloat bottom = 10 ; //拉伸区域距离底端高度
- // CGFloat left = 10; // 拉伸区域距离左端宽度
- // CGFloat right = 10; // 拉伸区域距离右端宽度
- // UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);
- // UIImageView *bimage=[UIImageView new];
- // bimage.image = [[UIImage imageNamed:@"Rectangle 18183"] resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];;
- // [self.contentView addSubview:bimage];
- // [bimage mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-24, 81));
- // make.top.equalTo(bigimage.mas_bottom).offset(25);
- // make.left.equalTo(self.contentView).offset(12);
- // }];
- //
- // UIImageView *lefttopbg=[UIImageView new];
- // lefttopbg.image =[UIImage imageNamed:@"Rectangle 18188"];
- // [bimage addSubview:lefttopbg];
- // [lefttopbg mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.size.mas_equalTo(CGSizeMake(94, 19));
- // make.top.left.equalTo(bimage);
- // }];
- //
- // UIImageView *lefttoplock=[UIImageView new];
- // lefttoplock.image = [UIImage imageNamed:@"Frame 4"];
- // [lefttopbg addSubview:lefttoplock];
- // [lefttoplock mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.size.mas_equalTo(CGSizeMake(12, 12));
- // make.top.equalTo(lefttopbg).offset(3);
- // make.left.equalTo(lefttopbg).offset(11);
- // }];
- //
- // UILabel *lefttoptip=[UILabel new];
- // lefttoptip.font = [UIFont systemFontOfSize:10];
- // lefttoptip.text = @"未解锁";
- // lefttoptip.textColor = rgba(255, 243, 181, 1);
- // [lefttopbg addSubview:lefttoptip];
- // [lefttoptip mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(lefttoplock);
- // make.left.equalTo(lefttoplock.mas_right).offset(2);
- // }];
- //
- // UILabel *viptit=[UILabel new];
- // viptit.font = [UIFont systemFontOfSize:16];
- // viptit.text = @"影视VIP";
- // viptit.textColor = rgba(255, 212, 0, 1);
- // [bimage addSubview:viptit];
- // [viptit mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(lefttopbg.mas_bottom).offset(8);
- // make.left.equalTo(bimage).offset(12);
- // }];
- //
- // UILabel *openVip=[UILabel new];
- // openVip.font = [UIFont systemFontOfSize:14];
- // openVip.text = @"立即开通";
- // openVip.textColor = rgba(246, 234, 167, 0.6);
- // [bimage addSubview:openVip];
- // [openVip mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.bottom.equalTo(bimage.mas_bottom).offset(-12);
- // make.left.equalTo(viptit);
- // }];
- //
- // UIImageView *openVipTip=[UIImageView new];
- // openVipTip.image = [UIImage imageNamed:@"Frame 9334"];
- // [bimage addSubview:openVipTip];
- // [openVipTip mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.size.mas_equalTo(CGSizeMake(16, 16));
- // make.centerY.equalTo(openVip);
- // make.left.equalTo(openVip.mas_right).offset(2);
- // }];
- //
- // UIImageView *vipicon=[UIImageView new];
- // vipicon.image = [UIImage imageNamed:@"image 96"];
- // [self.contentView addSubview:vipicon];
- // [vipicon mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.size.mas_equalTo(CGSizeMake(119, 109));
- // make.bottom.equalTo(bimage);
- // make.right.equalTo(bimage.mas_right).offset(-12);
- // }];
-
- }
- @end
- @implementation AccountCenterCell
- + (instancetype)cellWithTableView:(UITableView *)tableView{
- static NSString *identifier = @"AccountCenterCell";
- AccountCenterCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
- if (cell == nil) {
- cell = [[AccountCenterCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
- }
-
- return cell;
- }
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- [self creatView];
- }
- return self;
- }
- -(void)setShowContentType:(int)showContentType{
- _showContentType = showContentType;
- if(showContentType==0){
- [self.bgView viewWithTag:310].hidden = true;
- [self.bgView viewWithTag:311].hidden = false;
- }else{
- [self.bgView viewWithTag:310].hidden = false;
- [self.bgView viewWithTag:311].hidden = true;
- }
- }
- -(void)setType:(int)type{
- _type = type;
- self.bgView.layer.mask = nil;
- if(self.type != 0){
- // 创建一个 UIView
- UIView *view = self.bgView;
- // 设置圆角大小和边框宽度
- CGFloat cornerRadius = 12.0; // 设置圆角半径
- // CGFloat borderWidth = 2.0; // 设置边框宽度
- // 创建圆角路径
- UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
- if(self.type == 1){
- path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
- }else if(self.type ==2){
- path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
- }else if(self.type == 3){
- path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
- }
- // 创建圆角图层
- CAShapeLayer *maskLayer = [CAShapeLayer layer];
- maskLayer.path = path.CGPath;
- view.layer.mask = maskLayer;
- }
- }
- //0.没有 1.上 2.下 3.全
- -(void)creatView{
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
-
- UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(12, 0, kScreenWidth - 24, 50)];
- self.bgView = bgView;
- bgView.backgroundColor = rgba(27, 31, 48, 1);
- [self.contentView addSubview:bgView];
- [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.top.equalTo(self.contentView);
- make.left.equalTo(self.contentView).offset(12);
- make.right.equalTo(self.contentView).offset(-12);
- }];
-
- // UIImageView *icon=[UIImageView new];
- // self.icon = icon;
- // [bgView addSubview:icon];
- // [icon mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.size.mas_equalTo(CGSizeMake(18, 18));
- // make.centerY.equalTo(bgView);
- // make.left.equalTo(bgView).offset(12);
- // }];
-
- UILabel *tit=[UILabel new];
- self.tit = tit;
- tit.font = [UIFont systemFontOfSize:16];
- tit.text = @"历史记录";
- tit.textColor = rgba(255, 255, 255, 0.8);
- [bgView addSubview:tit];
- [tit mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(bgView);
- make.left.equalTo(bgView).offset(16);
- }];
-
-
- UIImageView *tip=[UIImageView new];
- tip.image = [UIImage imageNamed:@"Frame 9366"];
- tip.tag = 311;
- [bgView addSubview:tip];
- [tip mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(16, 16));
- make.centerY.equalTo(bgView);
- make.right.equalTo(bgView).offset(-16);
- }];
-
- UILabel *titDetail=[UILabel new];
- titDetail.tag = 310;
- titDetail.font = [UIFont systemFontOfSize:14];
- titDetail.text = @"1.0.0";
- titDetail.textColor = rgba(255, 255, 255, 0.6);
- [bgView addSubview:titDetail];
- [titDetail mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(bgView);
- make.right.equalTo(bgView).offset(-16);
- }];
-
- }
- @end
|