酷店

KDPAccountVC.m 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // KDPAccountVC.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/8.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPAccountVC.h"
  9. #import "KDPAccountListCell.h"
  10. @interface KDPAccountVC ()<UITableViewDelegate,UITableViewDataSource>
  11. {
  12. UILabel *_accountMoneyLabel;
  13. }
  14. @property(nonatomic,strong)UITableView *accountView;
  15. @end
  16. @implementation KDPAccountVC
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. [self setNavUI];
  20. }
  21. -(void)setNavUI
  22. {
  23. self.view.backgroundColor=[UIColor whiteColor];
  24. [self.navBar addleftReturnButton:self selector:@selector(returnClickBtn)];
  25. self.navBar.navTitleLabel.text=@"我的账户";
  26. [self.view addSubview:self.accountView];
  27. [self.accountView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. }];
  29. }
  30. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  31. {
  32. KDPAccountListCell *listC=[tableView dequeueReusableCellWithIdentifier:@"account"];
  33. if (!listC) {
  34. listC=[[KDPAccountListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"account"];
  35. listC.selectionStyle=UITableViewCellSelectionStyleNone;
  36. }
  37. return listC;
  38. }
  39. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  40. {
  41. return 5;
  42. }
  43. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  44. {
  45. }
  46. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  47. {
  48. return 80;
  49. }
  50. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  51. {
  52. return 1;
  53. }
  54. -(void)returnClickBtn
  55. {
  56. [self.navigationController popViewControllerAnimated:YES];
  57. }
  58. -(void)viewWillAppear:(BOOL)animated
  59. {
  60. [super viewWillAppear:animated];
  61. self.navigationController.navigationBar.hidden=YES;
  62. self.tabBarController.tabBar.hidden=YES;
  63. }
  64. -(void)viewWillDisappear:(BOOL)animated
  65. {
  66. [super viewWillDisappear:animated];
  67. self.tabBarController.tabBar.hidden=NO;
  68. }
  69. -(UITableView *)accountView
  70. {
  71. if (!_accountView) {
  72. _accountView=[[UITableView alloc]initWithFrame:CGRectMake(0, KDNavBarHeight, SCREEN_WIDTH, self.view.height)];
  73. _accountView.backgroundColor=[UIColor clearColor];
  74. _accountView.separatorStyle=UITableViewCellSeparatorStyleNone;
  75. _accountView.delegate=self;
  76. _accountView.dataSource=self;
  77. [self addAccountviews];
  78. }
  79. return _accountView;
  80. }
  81. -(void)addAccountviews
  82. {
  83. UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 104)];
  84. backV.backgroundColor=[UIColor gradientOneColor:[UIColor colorWithHexString:@"#FF235F"] toColor:[UIColor colorWithHexString:@"#FF7676"] Width:SCREEN_WIDTH];
  85. self.accountView.tableHeaderView=backV;
  86. _accountMoneyLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, backV.height)];
  87. _accountMoneyLabel.center=backV.center;
  88. _accountMoneyLabel.font=[UIFont systemFontOfSize:48];
  89. _accountMoneyLabel.textAlignment=NSTextAlignmentCenter;
  90. _accountMoneyLabel.textColor=[UIColor whiteColor];
  91. NSString *title = @"¥---.--";
  92. NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:title];
  93. [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0,1)]; //设置字体字号和字体类别
  94. _accountMoneyLabel.attributedText = str;
  95. [backV addSubview:_accountMoneyLabel];
  96. }
  97. @end