websocket and user center
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "GiGaBaseViewController.h"
|
||||
|
||||
@interface GiGaMeViewController : UIViewController
|
||||
@interface GiGaMeViewController : GiGaBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#import "GiGaMeViewController.h"
|
||||
#import "GiGaUserViewController.h"
|
||||
#import "GiGaMineUserViewCell.h"
|
||||
#import "GiGaMineInfoViewCell.h"
|
||||
#import "GiSysSettingsVC.h"
|
||||
#import "GiMaskTimeHistoryVC.h"
|
||||
|
||||
@interface GiGaMeViewController ()
|
||||
|
||||
@@ -17,21 +21,105 @@
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"我的";
|
||||
|
||||
[self addNavTitile:@"我的"];
|
||||
// Do any additional setup after loading the view.
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor lightGrayColor];
|
||||
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
|
||||
self.tableView.sectionFooterHeight = 0;
|
||||
self.tableView.estimatedSectionFooterHeight= 0;
|
||||
self.tableView.estimatedSectionHeaderHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
|
||||
if (section == 0){
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if(indexPath.section ==0){
|
||||
GiGaMineUserViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GiGaMineUserViewCell"];
|
||||
if(!cell){
|
||||
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaMineUserViewCell" owner:self options:nil] lastObject];
|
||||
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
GiGaMineInfoViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GiGaMineInfoViewCell"];
|
||||
if(!cell){
|
||||
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaMineInfoViewCell" owner:self options:nil] lastObject];
|
||||
|
||||
}
|
||||
|
||||
[cell loadCellData:indexPath];
|
||||
return cell;
|
||||
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if(indexPath.section == 1){
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
}
|
||||
|
||||
if(indexPath.section == 0){
|
||||
GiGaUserViewController *userVC= [[GiGaUserViewController alloc] init];
|
||||
[self.navigationController pushViewController:userVC animated:YES];
|
||||
|
||||
}else{
|
||||
if (indexPath.section == 1 && indexPath.row == 0 ){
|
||||
//历史记录
|
||||
GiMaskTimeHistoryVC *historyVC= [[GiMaskTimeHistoryVC alloc] init];
|
||||
[self.navigationController pushViewController:historyVC animated:YES];
|
||||
|
||||
}else{
|
||||
//系统设置
|
||||
GiSysSettingsVC*settingsVC= [[GiSysSettingsVC alloc] init];
|
||||
[self.navigationController pushViewController:settingsVC animated:YES];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if(indexPath.section==0){
|
||||
return 180;
|
||||
|
||||
}else {
|
||||
return 54;
|
||||
}
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
if (section == 1){
|
||||
return 20;
|
||||
}
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
GiGaUserViewController *userVC= [[GiGaUserViewController alloc] init];
|
||||
[self.navigationController pushViewController:userVC animated:YES];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "GiGaBaseViewController.h"
|
||||
|
||||
@interface GiGaUserViewController : UIViewController
|
||||
@interface GiGaUserViewController : GiGaBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.title = @"个人中心";
|
||||
//self.title = @"个人中心";
|
||||
[self addNavTitile:@"个人中心"];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// GiMaskTimeHistoryVC.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/3.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiGaBaseViewController.h"
|
||||
|
||||
@interface GiMaskTimeHistoryVC : GiGaBaseViewController
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// GiMaskTimeHistoryVC.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/3.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiMaskTimeHistoryVC.h"
|
||||
|
||||
@interface GiMaskTimeHistoryVC ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation GiMaskTimeHistoryVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self addNavTitile:@"历史记录"];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// GiSysSettingsVC.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/3.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiGaBaseViewController.h"
|
||||
|
||||
@interface GiSysSettingsVC : GiGaBaseViewController
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// GiSysSettingsVC.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/3.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiSysSettingsVC.h"
|
||||
#import "GiGaSettingsViewCell.h"
|
||||
#import "JXTAlertController.h"
|
||||
|
||||
@interface GiSysSettingsVC ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation GiSysSettingsVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[self addNavTitile:@"系统设置"];
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor lightGrayColor];
|
||||
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
|
||||
self.tableView.sectionFooterHeight = 0;
|
||||
self.tableView.estimatedSectionFooterHeight= 0;
|
||||
self.tableView.estimatedSectionHeaderHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
GiGaSettingsViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GiGaSettingsViewCell"];
|
||||
|
||||
if(!cell){
|
||||
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaSettingsViewCell" owner:self options:nil] lastObject];
|
||||
}
|
||||
|
||||
[cell loadCellDataAt:indexPath];
|
||||
return cell;
|
||||
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 54;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 100;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
|
||||
return 10;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
||||
|
||||
UIView *view = [[UIView alloc] init];
|
||||
view.frame = CGRectMake(0, 0, KMainW, 100);
|
||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
btn.frame = CGRectMake(30, 50, KMainW - 30*2, 50);
|
||||
[btn setTitle:@"退出登录" forState:UIControlStateNormal];
|
||||
btn.layer.masksToBounds = YES;
|
||||
btn.layer.cornerRadius = btn.frame.size.height / 2;
|
||||
btn.backgroundColor = [UIColor greenColor];
|
||||
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[btn addTarget:self action:@selector(userLogOutAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[view addSubview:btn];
|
||||
return view;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
#pragma mark - 退出登录
|
||||
-(void)userLogOutAction{
|
||||
|
||||
[self jxt_showAlertWithTitle:@"温馨提示" message:@"确定退出?" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
|
||||
alertMaker.addActionCancelTitle(@"取消");
|
||||
alertMaker.addActionDestructiveTitle(@"退出");
|
||||
|
||||
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
|
||||
|
||||
switch (buttonIndex) {
|
||||
|
||||
case 1:
|
||||
{
|
||||
GILog(@"退出登录");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
GILog(@"取消");
|
||||
break;
|
||||
}
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user