My_CenterVC.m 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. //
  2. // My_CenterVC.m
  3. // smartRhino
  4. //
  5. // Created by armin on 2019/11/1.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "My_CenterVC.h"
  9. #import "My_CenterCell.h"
  10. #import "MyInfoVC.h"
  11. #import "SettingVC.h"
  12. #import "FavoritesViewController.h"
  13. #import "MyFavoriteVC.h"
  14. #import "MyCardVC.h"
  15. #import "NoteBookVC.h"
  16. #import "MyAccountVC.h"
  17. @interface My_CenterVC ()<UITableViewDelegate,UITableViewDataSource>
  18. @property (strong,nonatomic) IBOutlet UITableView *tableView;
  19. @end
  20. @implementation My_CenterVC
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. self.fd_prefersNavigationBarHidden = YES;
  24. self.view.backgroundColor = RGB(240, 239, 244);
  25. if (@available(iOS 11.0, *)) {
  26. self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  27. } else {
  28. self.automaticallyAdjustsScrollViewInsets = NO;
  29. }
  30. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PushSettingVC:) name:DRAWERPUSHVC object:nil];
  31. self.tableView.delegate = self;
  32. self.tableView.dataSource = self;
  33. self.tableView.backgroundColor = [UIColor clearColor];
  34. self.tableView.estimatedRowHeight = 0;
  35. self.tableView.estimatedSectionHeaderHeight = 0;
  36. self.tableView.estimatedSectionFooterHeight = 0;
  37. [UserManager getUserInfoDetail];
  38. }
  39. - (void)dealloc
  40. {
  41. [[NSNotificationCenter defaultCenter] removeObserver:self];
  42. }
  43. - (void)viewWillAppear:(BOOL)animated{
  44. [super viewWillAppear:animated];
  45. [self.tableView reloadData];
  46. }
  47. - (BOOL)hidesBottomBarWhenPushed
  48. {
  49. return NO;
  50. }
  51. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  52. return 2;
  53. }
  54. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  55. switch (section) {
  56. case 0:{
  57. return 1;
  58. }break;
  59. case 1:{
  60. return 3;
  61. }break;
  62. default:break;
  63. }
  64. return 0;
  65. }
  66. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  67. switch (indexPath.section) {
  68. case 0:{
  69. return [My_CenterCell configCell0Height];
  70. }break;
  71. case 1:{
  72. return [My_CenterCell configCell1Height];
  73. }break;
  74. default:break;
  75. }
  76. return 0;
  77. }
  78. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  79. switch (indexPath.section) {
  80. case 0:{
  81. My_CenterCell *cell = [My_CenterCell configCell0:tableView indexPath:indexPath];
  82. [cell.cell0UserImgView sd_setImageWithURL:[NSURL URLWithString:[AppUserModel sharedAppUserModel].AvatarUrl] placeholderImage:[UIImage imageNamed:@"my_conter_TestUserImg"]];
  83. NSLog(@"%@",[AppUserModel sharedAppUserModel].Name);
  84. cell.cell0UserName.text = ISEmptyString([AppUserModel sharedAppUserModel].Nick) ? @"昵称":[AppUserModel sharedAppUserModel].Nick;
  85. cell.cell0Intrt.text = ISEmptyString([AppUserModel sharedAppUserModel].Description) ? @"自我介绍":[AppUserModel sharedAppUserModel].Description ;
  86. return cell;
  87. }break;
  88. case 1:{
  89. My_CenterCell *cell = [My_CenterCell configCell1:tableView indexPath:indexPath];
  90. switch (indexPath.row) {
  91. case 0: {
  92. cell.cell1IconImg.image = [UIImage imageNamed:@"mine_account"];
  93. cell.cell1TitleLabel.text = @"账户";
  94. }break;
  95. case 1: {
  96. cell.cell1IconImg.image = [UIImage imageNamed:@"mine_wuxianka"];
  97. cell.cell1TitleLabel.text = @"无限卡";
  98. }break;
  99. case 2: {
  100. cell.cell1IconImg.image = [UIImage imageNamed:@"my_conter_setting_icon"];
  101. cell.cell1TitleLabel.text = @"设置";
  102. }break;
  103. default:
  104. break;
  105. }
  106. return cell;
  107. }break;
  108. default:break;
  109. }
  110. return nil;
  111. }
  112. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  113. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  114. switch (indexPath.section) {
  115. case 0:{
  116. switch (indexPath.row) {
  117. case 0:{
  118. MyInfoVC *vc = [MyInfoVC initMyInfoVC];
  119. vc.hidesBottomBarWhenPushed = YES;
  120. [self.navigationController pushViewController:vc animated:YES];
  121. }break;
  122. default:
  123. break;
  124. }
  125. }break;
  126. case 1:{
  127. switch (indexPath.row) {
  128. case 0:{
  129. MyAccountVC *vc = [MyAccountVC initMyAccountVC];
  130. vc.hidesBottomBarWhenPushed = YES;
  131. [self.navigationController pushViewController:vc animated:YES];
  132. }break;
  133. case 1:{
  134. MyCardVC * vc = [MyCardVC initMyCardVC];
  135. vc.hidesBottomBarWhenPushed = YES;
  136. [self.navigationController pushViewController:vc animated:YES];
  137. }break;
  138. case 2:{
  139. SettingVC *vc = [SettingVC initSettingVC];
  140. vc.hidesBottomBarWhenPushed = YES;
  141. [self.navigationController pushViewController:vc animated:YES];
  142. }break;
  143. default:
  144. break;
  145. }
  146. }break;
  147. default:
  148. break;
  149. }
  150. }
  151. - (void)PushSettingVC:(NSNotification *)notification
  152. {
  153. NSInteger index = [[notification.userInfo objectForKey:VCINDEX] integerValue];
  154. switch (index) {
  155. case 2:
  156. {
  157. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  158. vc.listType = MyFavoriteListLevelTypeA;
  159. vc.FolderId = 0;
  160. vc.operationStateEnum = OperationStateEnum0;
  161. vc.myTitle = @"我的收藏";
  162. vc.hidesBottomBarWhenPushed = YES;
  163. [self.navigationController pushViewController:vc animated:YES];
  164. }
  165. break;
  166. case 3:
  167. {
  168. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  169. vc.listType = MyNoteBookListLevelTypeA;
  170. vc.FolderId = 0;
  171. vc.myTitle = @"我的笔记";
  172. vc.VisitUserId = 0;
  173. vc.operationStateEnum = OperationStateEnum0;
  174. vc.hidesBottomBarWhenPushed = YES;
  175. [self.navigationController pushViewController:vc animated:YES];
  176. }
  177. break;
  178. case 4:
  179. {
  180. SettingVC *vc = [SettingVC initSettingVC];
  181. vc.hidesBottomBarWhenPushed = YES;
  182. [self.navigationController pushViewController:vc animated:YES];
  183. }
  184. break;
  185. default:
  186. break;
  187. }
  188. }
  189. @end