123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- //
- // cloudPhoneModelViewController.m
- // 双子星云手机
- //
- // Created by xd h on 2024/11/1.
- //
- #import "cloudPhoneModelViewController.h"
- #import "MineViewCell.h"
- @interface cloudPhoneModelViewController ()<UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic, strong, nullable) UITableView *tableView;
- @end
- @implementation cloudPhoneModelViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self.titleLabel setText:NSLocalizedString(@"mine_cloudPhone_Model_title",nil)];
- [self.view setBackgroundColor:HWF5F7FAColor];
-
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
- [self.navBarBGView setHidden:NO];
-
- [self drawAnyView];
- }
- - (void)drawAnyView{
- [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.equalTo(self.navBarBGView.mas_bottom).offset(16.f);
- }];
- }
- #pragma mark - 懒加载
- - (UITableView *)tableView{
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
- _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.scrollEnabled = NO;
- [_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 1;
- }
- - (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];
- [cell.maskSwitch setHidden:YES];
- if (row == 0){
- [cell.titleLabel setText:NSLocalizedString(@"mine_cloudPhone_Model_title",nil)];
- cell.titleLabel.font = [UIFont boldSystemFontOfSize:14.0];
-
- [cell.mImageView setImage:[UIImage imageNamed:@"mine_cloudPhone_model_icon"]];
- [cell.rightImage setHidden:YES];
- [cell.maskSwitch setHidden:NO];
-
- BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_cloudPhone_Model_Open];
- [cell.maskSwitch setOn:haveOpenMask];
- /*下圆角*/
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
- byRoundingCorners:UIRectCornerAllCorners
- 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];
-
- KWeakSelf
- cell.didClickMaskSwitch = ^(UISwitch * _Nonnull maskSwitch) {
- [weakSelf maskSwitchPressed:maskSwitch];
- };
- }
-
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 60;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- {
- return 50;
- }
- - (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
- {
- UIView *tailView = [UIView new];
-
- UILabel *tipLab = [[UILabel alloc] init];
- tipLab.backgroundColor = [UIColor clearColor];
- tipLab.font = [UIFont systemFontOfSize:12.0];
- tipLab.textColor = HW666666Color;
- tipLab.numberOfLines = 0;
- tipLab.text = NSLocalizedString(@"cloudPhone_Model_tip",nil);
- [tailView addSubview:tipLab];
-
- [tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.right.mas_equalTo(-15);
- make.bottom.mas_equalTo(0);
- make.top.mas_equalTo(0);
- }];
-
- return tailView;
- }
- - (void)maskSwitchPressed:(UISwitch *)maskSwitch{
-
- [HWDataManager setBoolWithKey:Const_cloudPhone_Model_Open value:maskSwitch.on];
-
- if (maskSwitch.on) {
- [[iToast makeText:NSLocalizedString(@"cloudPhone_Model_open_tip",nil)] show];
- }
- else{
- [[iToast makeText:NSLocalizedString(@"cloudPhone_Model_close_tip",nil)] show];
- }
-
- }
- @end
|