My_CenterVC.m 7.4 KB

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