133 lines
3.8 KiB
Objective-C
133 lines
3.8 KiB
Objective-C
//
|
|
// 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"
|
|
#import "GiGaUserDefault.h"
|
|
#import "GiGaUserManager.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 whiteColor];
|
|
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 = GIGA_MAIN_BGCOLOR;
|
|
[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(@"退出登录");
|
|
[self userlogOut];
|
|
}
|
|
break;
|
|
|
|
default:
|
|
GILog(@"取消");
|
|
break;
|
|
}
|
|
}];
|
|
}
|
|
|
|
-(void)userlogOut{
|
|
|
|
[[GiGaUserManager shareUser] loginOut];
|
|
NC_POST_NAME_OBJECT(kUserLogOutNotify, nil);
|
|
[self.navigationController popToRootViewControllerAnimated:YES];
|
|
}
|
|
|
|
|
|
@end
|