123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478 |
- //
- // mySetHeadView.m
- // 隐私保护
- //
- // Created by xd h on 2023/11/9.
- //
- #import "mySetHeadView.h"
- @interface mySetHeadView ()
- {
- UIView *imageBackupsBgView;
- UILabel *imageBackupsLabel;
- UIButton *imageBackupsButton;
- }
- @end
- @implementation mySetHeadView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
-
- [self drawAnyView];
-
- return self;
- }
- - (void)drawAnyView{
- [self setBackgroundColor:[UIColor hwColor:@"#F5F7FA" alpha:1.0]];
- //self.backgroundColor = [UIColor redColor];
-
- //setting_Privacy_bg
- UIImageView *PrivacyBg = [[UIImageView alloc] init];
- PrivacyBg.image = [UIImage imageNamed:@"setting_Privacy_bg"];
- //PrivacyBg.contentMode = UIViewContentModeScaleAspectFit;
- PrivacyBg.userInteractionEnabled = YES;
- [self addSubview:PrivacyBg];
- //PrivacyBg.backgroundColor = [UIColor greenColor];
-
- CGFloat PrivacyBgW = SCREEN_W - 20;
- CGFloat PrivacyBgH = 116.0 * PrivacyBgW / (345.0);
-
- [PrivacyBg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(PrivacyBgW);
- make.height.mas_equalTo(PrivacyBgH);
- }];
-
- UILabel *PrivacyTitleLabel = [[UILabel alloc] init];
- PrivacyTitleLabel.text = NSLocalizedString(@"my_set_Privacy_Model",nil) ;
- PrivacyTitleLabel.font = [UIFont boldSystemFontOfSize:16.0];
- PrivacyTitleLabel.textColor = [UIColor hwColor:@"0A132B" alpha:1.0];
- [PrivacyBg addSubview:PrivacyTitleLabel];
- [PrivacyTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(15);
- make.width.mas_equalTo(150);
- make.height.mas_equalTo(20);
- }];
-
- UIButton *setPrivacyBut = [[UIButton alloc] init];
-
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = CGRectMake(0,0,80.f,32.f);
- gl.startPoint = CGPointMake(0, 0.5);
- gl.endPoint = CGPointMake(1, 0.5);
- gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
- gl.locations = @[@(0), @(1.0f)];
- [setPrivacyBut.layer addSublayer:gl];
-
- setPrivacyBut.tag = 4;
- [setPrivacyBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- setPrivacyBut.layer.cornerRadius = 16.0;
- setPrivacyBut.layer.masksToBounds = YES;
- [setPrivacyBut setTitle:NSLocalizedString(@"set_Privacy_button_title",nil) forState:UIControlStateNormal];
- setPrivacyBut.titleLabel.font = [UIFont systemFontOfSize:12.0];
- [PrivacyBg addSubview:setPrivacyBut];
- [setPrivacyBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(80);
- make.height.mas_equalTo(32);
- }];
-
- UILabel *PrivacyTipLabel = [[UILabel alloc] init];
- PrivacyTipLabel.text = NSLocalizedString(@"set_Privacy_Tip",nil) ;
- PrivacyTipLabel.font = [UIFont systemFontOfSize:14.0];
- PrivacyTipLabel.textColor = [UIColor hwColor:@"#01B7EA" alpha:1.0];
- [PrivacyBg addSubview:PrivacyTipLabel];
- [PrivacyTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(PrivacyTitleLabel.mas_bottom).offset(10);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(20);
- }];
-
- UILabel *PrivacyTipLabel2 = [[UILabel alloc] init];
- PrivacyTipLabel2.text = NSLocalizedString(@"my_set_Privacy_Mode_tip1",nil) ;
- PrivacyTipLabel2.font = [UIFont systemFontOfSize:12.0];
- PrivacyTipLabel2.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
- PrivacyTipLabel2.numberOfLines = 0;
- [PrivacyBg addSubview:PrivacyTipLabel2];
- [PrivacyTipLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(PrivacyTipLabel.mas_bottom).offset(10);
- make.right.mas_equalTo(-10);
- make.height.mas_equalTo(40);
- }];
-
-
- //文件上传
- UIView *fileUploadBgView = [[UIView alloc] init];
- fileUploadBgView.backgroundColor = [UIColor whiteColor];
- fileUploadBgView.layer.cornerRadius = 8;
- [self addSubview:fileUploadBgView];
-
- [fileUploadBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(PrivacyBg.mas_bottom).offset(15);
- make.right.mas_equalTo(-10);
- make.height.mas_equalTo(110);
- }];
-
- UILabel *titleLabel = [[UILabel alloc] init];
- titleLabel.text = NSLocalizedString(@"my_set_no_File_upload_title",nil) ;
- titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
- [fileUploadBgView addSubview:titleLabel];
- [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(20);
- }];
- //上传记录
- UIImageView *arrowImageView = [[UIImageView alloc] init];
- arrowImageView.image = [UIImage imageNamed:@"cell_right_access"];
- [fileUploadBgView addSubview:arrowImageView];
- [arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(20);
- make.height.mas_equalTo(20);
- }];
- UILabel *rightLabel = [[UILabel alloc] init];
- rightLabel.text = NSLocalizedString(@"set_upload_download_tip",nil) ;
- rightLabel.font = [UIFont systemFontOfSize:14.0];
- rightLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
- rightLabel.textAlignment = NSTextAlignmentRight;
- [fileUploadBgView addSubview:rightLabel];
- [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(200);
- make.height.mas_equalTo(20);
- }];
- UIButton *recordBut = [[UIButton alloc] init];
- //recordBut.backgroundColor = [UIColor greenColor];
- recordBut.tag = 1;
- [recordBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- [fileUploadBgView addSubview:recordBut];
- [recordBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.width.mas_equalTo(150);
- make.height.mas_equalTo(40);
- }];
- //图片上传
- NSString* curImgUploadStr = [[NSString alloc] initWithFormat:@"%@ %@",@" ",NSLocalizedString(@"my_set_no_image_upload",nil)];
- UIButton *imageUploadBut = [[UIButton alloc] init];
- [imageUploadBut setImage:[UIImage imageNamed:@"icon_image_upload"] forState:UIControlStateNormal];
- [imageUploadBut setTitle:curImgUploadStr forState:UIControlStateNormal];
- imageUploadBut.backgroundColor = [UIColor hwColor:@"#00D1C1" alpha:0.1];
- imageUploadBut.layer.cornerRadius = 4;
- [imageUploadBut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- imageUploadBut.titleLabel.font = [UIFont systemFontOfSize:13.0];
- imageUploadBut.tag = 2;
- [imageUploadBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- [fileUploadBgView addSubview:imageUploadBut];
- [imageUploadBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.right.mas_equalTo(self.mas_centerX).offset(-10);
- make.bottom.mas_equalTo(-10);
- make.height.mas_equalTo(48);
- }];
- //视频上传
- NSString* curVidelUploadStr = [[NSString alloc] initWithFormat:@"%@ %@",@" ",NSLocalizedString(@"my_set_no_video_upload",nil)];
- UIButton *videoUploadBut = [[UIButton alloc] init];
- [videoUploadBut setImage:[UIImage imageNamed:@"icon_video_upload"] forState:UIControlStateNormal];
- [videoUploadBut setTitle:curVidelUploadStr forState:UIControlStateNormal];
- videoUploadBut.backgroundColor = [UIColor hwColor:@"#00D8FF" alpha:0.1];
- videoUploadBut.layer.cornerRadius = 4;
- [videoUploadBut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- videoUploadBut.titleLabel.font = [UIFont systemFontOfSize:13.0];
- videoUploadBut.tag = 3;
- [videoUploadBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- [fileUploadBgView addSubview:videoUploadBut];
- [videoUploadBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10);
- make.left.mas_equalTo(self.mas_centerX).offset(10);
- make.bottom.mas_equalTo(-10);
- make.height.mas_equalTo(48);
- }];
-
-
- //文件备份
- UIView *fileBackupsBgView = [[UIView alloc] init];
- fileBackupsBgView.backgroundColor = [UIColor whiteColor];
- fileBackupsBgView.layer.cornerRadius = 8;
- [self addSubview:fileBackupsBgView];
-
- [fileBackupsBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(fileUploadBgView.mas_bottom).offset(15);
- make.right.mas_equalTo(-10);
- make.height.mas_equalTo(110);
- }];
-
- UILabel *BackupsTitleLabel = [[UILabel alloc] init];
- BackupsTitleLabel.text = NSLocalizedString(@"set_Privacy_title",nil) ;
- BackupsTitleLabel.font = [UIFont boldSystemFontOfSize:16.0];
- [fileBackupsBgView addSubview:BackupsTitleLabel];
- [BackupsTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(20);
- }];
- //
- UIImageView *arrowImageView2 = [[UIImageView alloc] init];
- arrowImageView2.image = [UIImage imageNamed:@"cell_right_access"];
- [fileBackupsBgView addSubview:arrowImageView2];
- [arrowImageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(20);
- make.height.mas_equalTo(20);
- }];
-
- NSString *BackupsRightTitle = NSLocalizedString(@"set_Privacy_right_tip",nil);
- CGFloat BackupsRightW = [BackupsRightTitle boundingRectWithSize:CGSizeMake(200, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width;
- BackupsRightW += 5;
-
- UILabel *BackupsRightLabel = [[UILabel alloc] init];
- BackupsRightLabel.text = BackupsRightTitle;
- BackupsRightLabel.font = [UIFont systemFontOfSize:14.0];
- BackupsRightLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
- BackupsRightLabel.textAlignment = NSTextAlignmentRight;
- [fileBackupsBgView addSubview:BackupsRightLabel];
- [BackupsRightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(BackupsRightW);
- make.height.mas_equalTo(20);
- }];
- UIButton *BackupsSetBut = [[UIButton alloc] init];
- //BackupsSetBut.backgroundColor = [UIColor greenColor];
- BackupsSetBut.tag = 5;
- [BackupsSetBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- [fileBackupsBgView addSubview:BackupsSetBut];
- [BackupsSetBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.left.mas_equalTo(BackupsRightLabel.mas_left);
- make.height.mas_equalTo(40);
- }];
-
- UIButton *BackupsEyeBut = [[UIButton alloc] init];
- //BackupsEyeBut.backgroundColor = [UIColor greenColor];
- [BackupsEyeBut setImage:[UIImage imageNamed:@"common_eye_open"] forState:UIControlStateNormal];
- [BackupsEyeBut setImage:[UIImage imageNamed:@"common_eye_close"] forState:UIControlStateSelected];
- BackupsEyeBut.tag = 6;
- [BackupsEyeBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- [fileBackupsBgView addSubview:BackupsEyeBut];
- [BackupsEyeBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(BackupsSetBut.mas_left).offset(0);
- make.centerY.mas_equalTo(BackupsRightLabel.mas_centerY);
- make.width.mas_equalTo(40);
- make.height.mas_equalTo(40);
- }];
-
- BackupsEyeBut.hidden = YES;
-
- imageBackupsBgView = [[UIView alloc] init];
- imageBackupsBgView.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
- imageBackupsBgView.layer.cornerRadius = 8;
- [fileBackupsBgView addSubview:imageBackupsBgView];
-
- [imageBackupsBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10);
- make.left.mas_equalTo(10);
- make.bottom.mas_equalTo(-10);
- make.height.mas_equalTo(56);
- }];
-
- UIImageView *backupsImageV = [[UIImageView alloc] init];
- backupsImageV.image = [UIImage imageNamed:@"image_backups_icon"];
- [imageBackupsBgView addSubview:backupsImageV];
-
- [backupsImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(0);
- make.left.mas_equalTo(10);
- make.width.mas_equalTo(28);
- make.height.mas_equalTo(28);
- }];
-
- UILabel *imageBackupsTitleLabel = [[UILabel alloc] init];
- imageBackupsTitleLabel.text = NSLocalizedString(@"set_Privacy_title_image",nil) ;
- imageBackupsTitleLabel.font = [UIFont systemFontOfSize:14.0];
- [imageBackupsBgView addSubview:imageBackupsTitleLabel];
- [imageBackupsTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(-10);
- make.left.mas_equalTo(backupsImageV.mas_right).offset(10);
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(20);
- }];
-
- UILabel *imageBackupsLabel = [[UILabel alloc] init];
- imageBackupsLabel.text = NSLocalizedString(@"set_Privacy_title_image_open",nil) ;
- imageBackupsLabel.font = [UIFont systemFontOfSize:12.0];
- imageBackupsLabel.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
- [imageBackupsBgView addSubview:imageBackupsLabel];
- [imageBackupsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(10);
- make.left.mas_equalTo(backupsImageV.mas_right).offset(10);
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(20);
- }];
-
- UIButton *imageBackupsButton = [[UIButton alloc] init];
- imageBackupsButton.backgroundColor = [UIColor hwColor:@"#DCF4FB" alpha:1.0];
- imageBackupsButton.tag = 7;
- [imageBackupsButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- imageBackupsButton.layer.cornerRadius = 12.0;
- imageBackupsButton.layer.masksToBounds = YES;
- [imageBackupsButton setTitle:NSLocalizedString(@"common_open",nil) forState:UIControlStateNormal];
- [imageBackupsButton setTitle:NSLocalizedString(@"common_close",nil) forState:UIControlStateSelected];
- [imageBackupsButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
- imageBackupsButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
- [imageBackupsBgView addSubview:imageBackupsButton];
- [imageBackupsButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10);
- make.centerY.mas_equalTo(0);
- make.width.mas_equalTo(60);
- make.height.mas_equalTo(24);
- }];
-
-
- //其他功能
- UIView *otherBgView = [[UIView alloc] init];
- otherBgView.backgroundColor = [UIColor whiteColor];
- otherBgView.layer.cornerRadius = 8;
- [self addSubview:otherBgView];
-
- [otherBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(fileBackupsBgView.mas_bottom).offset(15);
- make.right.mas_equalTo(-10);
- make.height.mas_equalTo(135);
- }];
-
- UILabel *otherTitleLabel = [[UILabel alloc] init];
- otherTitleLabel.text = NSLocalizedString(@"set_other_title",nil) ;
- otherTitleLabel.font = [UIFont boldSystemFontOfSize:16.0];
- [otherBgView addSubview:otherTitleLabel];
- [otherTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(20);
- }];
-
-
- NSArray *titleArr = @[NSLocalizedString(@"my_set_no_change_phone",nil),
- NSLocalizedString(@"my_set_no_restart_phone",nil),
- NSLocalizedString(@"my_set_no_Restore_Factory",nil),
- NSLocalizedString(@"my_set_no_common_problem",nil),
- NSLocalizedString(@"my_set_no_check_update",nil)];
-
- NSArray *imageArr = @[@"icon_change_ohone",@"icon-gengxin",@"icon_Restore_Factory",@"icon_common_problem",@"app_update"];
-
- CGFloat butWidth = (SCREEN_W -20)/titleArr.count;
- CGFloat butHeight = 88.0;
-
- for (int i=0; i<titleArr.count; i++) {
-
- UILabel *curlab = [[UILabel alloc] init];
- curlab.text = titleArr[i];
- curlab.font = [UIFont systemFontOfSize:12.0];
- curlab.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
- curlab.numberOfLines = 0;
- curlab.textAlignment = NSTextAlignmentCenter;
- [otherBgView addSubview:curlab];
-
- [curlab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(butWidth*i);
- make.bottom.mas_equalTo(-10);
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(30);
- }];
-
- UIButton *curImageV = [[UIButton alloc] init];
- curImageV.userInteractionEnabled = NO;
- [curImageV setImage:[UIImage imageNamed:imageArr[i]] forState:UIControlStateNormal];;
- [otherBgView addSubview:curImageV];
-
- [curImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(butWidth*i);
- make.bottom.mas_equalTo(curlab.mas_top);
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(40);
- }];
-
- UIButton *curButton = [[UIButton alloc] init];
- //curButton.backgroundColor = [UIColor greenColor];
- curButton.tag = 10 + i;
- [curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- //[curButton setTitle:titleArr[i] forState:UIControlStateNormal];
- //[curButton setTitleColor:[UIColor hwColor:@"#0A132B" alpha:1.0] forState:UIControlStateNormal];
- //[curButton setImage:[UIImage imageNamed:imageArr[i]] forState:UIControlStateNormal];
- //curButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
- [otherBgView addSubview:curButton];
- [curButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(butWidth*i);
- make.bottom.mas_equalTo(0);
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(butHeight);
- }];
-
-
- }
- }
- #pragma mark 按钮点击事件
- - (void)didClickButFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
-
- //HLog(@"xxxx:%ld",tag)
-
- if(_didClickBut){
- _didClickBut(tag);
- }
- }
- @end
|