//
//  ZhanghaoCntroller.m
//  AIIM
//
//  Created by gan on 2025/4/21.
//

#import <Foundation/Foundation.h>
#import "ZhanghaoCntroller.h"



@interface ZhanghaoCntroller()<UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;

@property (strong,nonatomic) NSMutableArray *cellDatas;

@end


@implementation ZhanghaoCntroller

-(void)viewDidLoad{
    [super viewDidLoad];
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
    [self initCelldata];
    [self initSubView];
}

-(void)initSubView{
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellT"];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
}

-(void)initCelldata{
    
    
    NSDictionary *d4 =@{
        @"name":@"userCenter-xiugaimm",
        @"image":@"wxiugmm",
    };
    NSDictionary *d5 =@{
        @"name":@"userCenter-anquanmm",
        @"image":@"wanquan",
    };
    NSDictionary *d6 =@{
        @"name":@"userCenter-yingysm",
        @"image":@"wyingys",
    };
    NSDictionary *d12 =@{
        @"name":@"userCenter-chongzhimm",
        @"image":@"wchongzmm",
    };
    NSDictionary *d13 =@{
        @"name":@"userCenter-zhuxiaozh",
        @"image":@"wzhuxiaozz",
    };
    
    _cellDatas = [[NSMutableArray alloc] init];

    [_cellDatas addObject:d4];
    [_cellDatas addObject:d5];
    [_cellDatas addObject:d6];
    [_cellDatas addObject:d12];
    [_cellDatas addObject:d13];
    
}

- (IBAction)gotoback:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    NSInteger section =indexPath.row;
    NSString *cellT =@"cellT";
    UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellT forIndexPath:indexPath];
    if(cell==nil){
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellT];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor clearColor];
    NSDictionary *time =_cellDatas[section];
    NSString *title = NSLocalizedString(time[@"name"], @"");
    
    cell.imageView.image = [UIImage imageNamed:time[@"image"]];
    cell.textLabel.text =title;
    cell.textLabel.textColor = [UIColor whiteColor];
    UIImageView *right = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow-right"]];
    CGRect ctfrm = cell.contentView.frame;
    right.frame = CGRectMake(ctfrm.size.width-30, 21, 20, 20);
    [cell.contentView addSubview:right];
    
    cell.contentView.layer.borderWidth = 0.5f;
    cell.contentView.layer.borderColor = [UIColor lightGrayColor].CGColor; //globalColor(GCTypeGreen);
    cell.contentView.layer.cornerRadius = 8.0f; // 可选，设置圆角
    return cell;

}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _cellDatas.count;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 52.0;
}

@end
