123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- //
- // MineCommonUsedView.m
- // 双子星云手机
- //
- // Created by xd h on 2024/6/21.
- //
- #import "MineCommonUsedView.h"
- @interface MineCommonUsedView ()
- @property(nonatomic,strong) UILabel*titleLabel;
- @end
- @implementation MineCommonUsedView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
-
- //self.backgroundColor = [UIColor clearColor];
- [self drawAnyView];
-
- return self;
- }
- -(void)drawAnyView
- {
- UIView *whiteBgView = [[UIView alloc] init];
- whiteBgView.backgroundColor = [UIColor whiteColor];
- [self addSubview:whiteBgView];
- whiteBgView.layer.cornerRadius = 12;
- whiteBgView.layer.masksToBounds = YES;
-
- [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.left.mas_equalTo(16);
- make.right.mas_equalTo(-16);
- make.bottom.mas_equalTo(0);
- }];
-
- _titleLabel = [[UILabel alloc] init];
- _titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
- _titleLabel.textColor = [UIColor hwColor:@"#0A132B"];
- _titleLabel.text = NSLocalizedString(@"NAS_common_used",nil);
- [whiteBgView addSubview:_titleLabel];
-
- [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(16);
- make.left.mas_equalTo(16);
- make.right.mas_equalTo(-24-12-10);
- make.height.mas_equalTo(20);
- }];
-
- NSArray *titleArr = @[NSLocalizedString(@"my_set_Privacy_Model",nil),
- //NSLocalizedString(@"mine_cloudPhone_Model_title",nil),
- //NSLocalizedString(@"mine_help_title",nil),
- NSLocalizedString(@"my_set_no_change_phone",nil),
-
- NSLocalizedString(@"my_set_no_connect_kefu",nil),
- NSLocalizedString(@"my_set_no_clear_cache",nil),
- NSLocalizedString(@"my_set_no_check_update",nil),
- //NSLocalizedString(@"mine_newuser_title",nil),
- //NSLocalizedString(@"mine_sn_cancel_title",nil)
- ];
-
-
-
- NSArray *imageArr = @[@"mine_Privacy_icon",
- @"mine_cloudPhone_model_icon",
- @"mine_help_icon",
- @"mine_changePhone_icon",
-
- @"mine_customer_icon",
- @"mine_clear_icon",
- @"mine_version_icon",
- @"mine_newUser_icon",
- //@"mine_cancell_icon",
- ];
-
- CGFloat butTopY = 50.0;
- CGFloat imageWH = 28.0;
-
- CGFloat butHeight = imageWH +20 +5;
- CGFloat butWidth = 70.0;
- CGFloat butSpace = (SCREEN_W -16*2 - butWidth*4)/5.0;
-
- for (int i=0; i<titleArr.count; i++) {
-
- UIButton *but = [[UIButton alloc] init];
- but.tag = 10+i;
- [but addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [whiteBgView addSubview:but];
- //but.backgroundColor = [UIColor greenColor];
-
- [but mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(butSpace + (butWidth+butSpace)*(i%4));
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(butHeight);
- make.top.mas_equalTo(butTopY + (i/4)* (butHeight + 25) );
- }];
-
- UIImageView *imageV = [[UIImageView alloc] init];
- imageV.image = [UIImage imageNamed:imageArr[i]];
- // imageV.layer.cornerRadius = 10;
- // imageV.layer.masksToBounds = YES;
- [but addSubview:imageV];
-
- [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.width.mas_equalTo(imageWH);
- make.height.mas_equalTo(imageWH);
- make.top.mas_equalTo(0);
- }];
-
- UILabel *textLabel = [[UILabel alloc] init];
- textLabel.textAlignment = NSTextAlignmentCenter;
- textLabel.font = [UIFont systemFontOfSize:13.0];
- textLabel.textColor = [UIColor hwColor:@"#828D9A"];
- textLabel.text = titleArr[i];
- textLabel.numberOfLines = 0;
- [but addSubview:textLabel];
- //textLabel.backgroundColor = [UIColor redColor];
-
- [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(35);
- make.top.equalTo(imageV.mas_bottom).offset(5);
- }];
-
- }
-
- }
- #pragma mark 按钮事件
- - (void)didClickButtonFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
- HLog(@"%ld",tag);
-
- if(_didClickButtonFun){
- _didClickButtonFun(tag);
- }
- }
- @end
|