123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- //
- // My_CenterVC.m
- // smartRhino
- //
- // Created by armin on 2019/11/1.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "My_CenterVC.h"
- #import "My_CenterCell.h"
- #import "MyInfoVC.h"
- #import "SettingVC.h"
- #import "FavoritesViewController.h"
- #import "MyFavoriteVC.h"
- #import "NoteBookVC.h"
- @interface My_CenterVC ()<UITableViewDelegate,UITableViewDataSource>
- @property (strong,nonatomic) IBOutlet UITableView *tableView;
- @end
- @implementation My_CenterVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.fd_prefersNavigationBarHidden = YES;
- self.view.backgroundColor = RGB(240, 239, 244);
-
- if (@available(iOS 11.0, *)) {
- self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PushSettingVC:) name:DRAWERPUSHVC object:nil];
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.backgroundColor = [UIColor clearColor];
- self.tableView.estimatedRowHeight = 0;
- self.tableView.estimatedSectionHeaderHeight = 0;
- self.tableView.estimatedSectionFooterHeight = 0;
- [UserManager getUserInfoDetail];
- }
- - (void)dealloc
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.tableView reloadData];
- }
- - (BOOL)hidesBottomBarWhenPushed
- {
- return NO;
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 2;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- switch (section) {
- case 0:{
- return 1;
- }break;
- case 1:{
- return 3;
- }break;
- default:break;
- }
- return 0;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- switch (indexPath.section) {
- case 0:{
- return [My_CenterCell configCell0Height];
- }break;
- case 1:{
- return [My_CenterCell configCell1Height];
- }break;
- default:break;
- }
- return 0;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- switch (indexPath.section) {
- case 0:{
- My_CenterCell *cell = [My_CenterCell configCell0:tableView indexPath:indexPath];
- [cell.cell0UserImgView sd_setImageWithURL:[NSURL URLWithString:[AppUserModel sharedAppUserModel].AvatarUrl] placeholderImage:[UIImage imageNamed:@"my_conter_TestUserImg"]];
- NSLog(@"%@",[AppUserModel sharedAppUserModel].Name);
- cell.cell0UserName.text = ISEmptyString([AppUserModel sharedAppUserModel].Nick) ? @"昵称":[AppUserModel sharedAppUserModel].Nick;
- cell.cell0Intrt.text = ISEmptyString([AppUserModel sharedAppUserModel].Description) ? @"自我介绍":[AppUserModel sharedAppUserModel].Description ;
- return cell;
- }break;
- case 1:{
- My_CenterCell *cell = [My_CenterCell configCell1:tableView indexPath:indexPath];
- switch (indexPath.row) {
- case 0: {
- cell.cell1IconImg.image = [UIImage imageNamed:@"my_conter_sc_icon"];
- cell.cell1TitleLabel.text = @"收藏";
- }break;
- case 1: {
- cell.cell1IconImg.image = [UIImage imageNamed:@"my_conter_biji_icon"];
- cell.cell1TitleLabel.text = @"笔记";
- }break;
- case 2: {
- cell.cell1IconImg.image = [UIImage imageNamed:@"my_conter_setting_icon"];
- cell.cell1TitleLabel.text = @"设置";
- }break;
- default:
- break;
- }
- return cell;
- }break;
- default:break;
- }
- return nil;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
-
- switch (indexPath.section) {
- case 0:{
- switch (indexPath.row) {
- case 0:{
- MyInfoVC *vc = [MyInfoVC initMyInfoVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- break;
- }
- }break;
- case 1:{
- switch (indexPath.row) {
- case 0:{
- MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = MyFavoriteListLevelTypeA;
- vc.FolderId = 0;
- vc.operationStateEnum = OperationStateEnum0;
- vc.myTitle = @"我的收藏";
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
-
- }break;
- case 1:{
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyNoteBookListLevelTypeA;
- vc.FolderId = 0;
- vc.myTitle = @"我的笔记";
- vc.VisitUserId = 0;
- vc.operationStateEnum = OperationStateEnum0;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case 2:{
- SettingVC *vc = [SettingVC initSettingVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- break;
- }
- }break;
- default:
- break;
- }
-
- }
- - (void)PushSettingVC:(NSNotification *)notification
- {
- NSInteger index = [[notification.userInfo objectForKey:VCINDEX] integerValue];
- switch (index) {
- case 2:
- {
- MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = MyFavoriteListLevelTypeA;
- vc.FolderId = 0;
- vc.operationStateEnum = OperationStateEnum0;
- vc.myTitle = @"我的收藏";
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 3:
- {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyNoteBookListLevelTypeA;
- vc.FolderId = 0;
- vc.myTitle = @"我的笔记";
- vc.VisitUserId = 0;
- vc.operationStateEnum = OperationStateEnum0;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case 4:
- {
- SettingVC *vc = [SettingVC initSettingVC];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- default:
- break;
- }
- }
- @end
|