酷店

KDPSetViewController.m 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //
  2. // KDPSetViewController.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/9.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPSetViewController.h"
  9. #import "KDPPhoneLoginViewController.h"
  10. @interface KDPSetViewController ()<UITableViewDelegate,UITableViewDataSource>
  11. {
  12. }
  13. @property(nonatomic,strong)UITableView *setView;
  14. @end
  15. @implementation KDPSetViewController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. [self.navBar addleftReturnButton:self selector:@selector(returnClickBtn)];
  19. self.navBar.navTitleLabel.text=@"设置";
  20. self.view.backgroundColor=[UIColor colorWithHexString:LineColor];
  21. [self.view addSubview:self.setView];
  22. [self.setView mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.top.mas_equalTo(KDNavBarHeight);
  24. make.left.right.mas_equalTo(0);
  25. make.bottom.mas_equalTo(self.view.mas_bottom).offset(-50);
  26. }];
  27. UIButton *exitButton=[[UIButton alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT-50, SCREEN_WIDTH, 50)];
  28. [exitButton setTitleColor:[UIColor colorWithHexString:ThemeColor] forState:UIControlStateNormal];
  29. [exitButton setTitle:@"退出登录" forState:UIControlStateNormal];
  30. exitButton.titleLabel.font=[UIFont systemFontOfSize:14];
  31. [exitButton addTarget:self action:@selector(exitClickButton) forControlEvents:UIControlEventTouchUpInside];
  32. exitButton.backgroundColor=[UIColor whiteColor];
  33. [self.view addSubview:exitButton];
  34. }
  35. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  36. {
  37. UITableViewCell *listC=[tableView dequeueReusableCellWithIdentifier:@"set"];
  38. if (!listC) {
  39. listC=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"set"];
  40. listC.selectionStyle=UITableViewCellSelectionStyleNone;
  41. }
  42. KDPAccountModel *model =[KDPAccountTool account];
  43. listC.textLabel.text=@"我的手机号";
  44. listC.textLabel.font=[UIFont systemFontOfSize:14];
  45. listC.textLabel.textColor=[UIColor colorWithHexString:fontColor];
  46. listC.detailTextLabel.text=model.phone;
  47. listC.detailTextLabel.font=[UIFont systemFontOfSize:14];
  48. listC.detailTextLabel.textColor=[UIColor colorWithHexString:@"#666666"];
  49. return listC;
  50. }
  51. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  52. {
  53. return 1;
  54. }
  55. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  56. {
  57. }
  58. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  59. {
  60. return 50;
  61. }
  62. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  63. {
  64. return 1;
  65. }
  66. -(UITableView *)setView
  67. {
  68. if (!_setView) {
  69. _setView=[[UITableView alloc]init];
  70. _setView.backgroundColor=[UIColor clearColor];
  71. _setView.separatorStyle=UITableViewCellSeparatorStyleNone;
  72. _setView.delegate=self;
  73. _setView.dataSource=self;
  74. }
  75. return _setView;
  76. }
  77. -(void)returnClickBtn
  78. {
  79. [self.navigationController popViewControllerAnimated:YES];
  80. }
  81. -(void)viewWillAppear:(BOOL)animated
  82. {
  83. [super viewWillAppear:animated];
  84. self.navigationController.navigationBar.hidden=YES;
  85. self.tabBarController.tabBar.hidden=YES;
  86. }
  87. -(void)viewWillDisappear:(BOOL)animated
  88. {
  89. [super viewWillDisappear:animated];
  90. self.tabBarController.tabBar.hidden=NO;
  91. }
  92. #pragma mark---退出登录
  93. -(void)exitClickButton
  94. {
  95. [KDPAccountTool deleteAccount];
  96. [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:[[UINavigationController alloc]initWithRootViewController:[[KDPPhoneLoginViewController alloc]init]] animated:YES completion:nil];
  97. [self.navigationController popToRootViewControllerAnimated:YES];
  98. }
  99. @end