My_CenterVC.m 7.1 KB

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