ZhanghaoCntroller.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //
  2. // ZhanghaoCntroller.m
  3. // AIIM
  4. //
  5. // Created by gan on 2025/4/21.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import "ZhanghaoCntroller.h"
  9. @interface ZhanghaoCntroller()<UITableViewDelegate,UITableViewDataSource>
  10. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  11. @property (strong,nonatomic) NSMutableArray *cellDatas;
  12. @end
  13. @implementation ZhanghaoCntroller
  14. -(void)viewDidLoad{
  15. [super viewDidLoad];
  16. [self.navigationController setNavigationBarHidden:YES animated:NO];
  17. [self initCelldata];
  18. [self initSubView];
  19. }
  20. -(void)initSubView{
  21. [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellT"];
  22. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  23. _tableView.backgroundColor = [UIColor clearColor];
  24. _tableView.delegate = self;
  25. _tableView.dataSource = self;
  26. }
  27. -(void)initCelldata{
  28. NSDictionary *d4 =@{
  29. @"name":@"userCenter-xiugaimm",
  30. @"image":@"wxiugmm",
  31. };
  32. NSDictionary *d5 =@{
  33. @"name":@"userCenter-anquanmm",
  34. @"image":@"wanquan",
  35. };
  36. NSDictionary *d6 =@{
  37. @"name":@"userCenter-yingysm",
  38. @"image":@"wyingys",
  39. };
  40. NSDictionary *d12 =@{
  41. @"name":@"userCenter-chongzhimm",
  42. @"image":@"wchongzmm",
  43. };
  44. NSDictionary *d13 =@{
  45. @"name":@"userCenter-zhuxiaozh",
  46. @"image":@"wzhuxiaozz",
  47. };
  48. _cellDatas = [[NSMutableArray alloc] init];
  49. [_cellDatas addObject:d4];
  50. [_cellDatas addObject:d5];
  51. [_cellDatas addObject:d6];
  52. [_cellDatas addObject:d12];
  53. [_cellDatas addObject:d13];
  54. }
  55. - (IBAction)gotoback:(id)sender {
  56. [self dismissViewControllerAnimated:YES completion:nil];
  57. }
  58. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  59. NSInteger section =indexPath.row;
  60. NSString *cellT =@"cellT";
  61. UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellT forIndexPath:indexPath];
  62. if(cell==nil){
  63. cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellT];
  64. }
  65. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  66. cell.backgroundColor = [UIColor clearColor];
  67. NSDictionary *time =_cellDatas[section];
  68. NSString *title = NSLocalizedString(time[@"name"], @"");
  69. cell.imageView.image = [UIImage imageNamed:time[@"image"]];
  70. cell.textLabel.text =title;
  71. cell.textLabel.textColor = [UIColor whiteColor];
  72. UIImageView *right = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow-right"]];
  73. CGRect ctfrm = cell.contentView.frame;
  74. right.frame = CGRectMake(ctfrm.size.width-30, 21, 20, 20);
  75. [cell.contentView addSubview:right];
  76. cell.contentView.layer.borderWidth = 0.5f;
  77. cell.contentView.layer.borderColor = [UIColor lightGrayColor].CGColor; //globalColor(GCTypeGreen);
  78. cell.contentView.layer.cornerRadius = 8.0f; // 可选,设置圆角
  79. return cell;
  80. }
  81. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  82. }
  83. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  84. return _cellDatas.count;
  85. }
  86. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  87. return 1;
  88. }
  89. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  90. return 52.0;
  91. }
  92. @end