| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- //
- // Setting_VC.m
- // Haishenghai-master
- //
- // Created by 刘云鸽 on 2019/3/2.
- // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved.
- //
- #import "Setting_VC.h"
- #import "Header.h"
- #import <JPUSHService.h>
- @interface Setting_VC ()<UITableViewDelegate,UITableViewDataSource>
- @end
- @implementation Setting_VC
- static NSInteger seq = 0;
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setUPUI];
- }
- -(void)setUPUI{
- self.navigationItem.title = @"设置";
- self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:60/255.0 green:114/255.0 blue:255/255.0 alpha:1];
- [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
- self.view.backgroundColor = [UIColor whiteColor];
- UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [backBtn setImage:[UIImage imageNamed:@"hsh_return"] forState:UIControlStateNormal];
- backBtn.frame = CGRectMake(0, 0, 44, 44);
- [backBtn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
- backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn];
-
- _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, HEIGHT) style:UITableViewStylePlain];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.userInteractionEnabled = YES;
- //表禁止滑动
- _tableView.scrollEnabled =NO;
- [self.view addSubview:_tableView];
- _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
-
- }
- -(void)backClick{
- [self.navigationController popViewControllerAnimated:YES];
- }
- #pragma mark-- tableviewDelegate
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 3;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- if (section==0) {
- return 1;
- }else if (section==1){
- return 3;
- }else{
- return 1;
- }
- return 0;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- if (indexPath.section==0) {
- return 44;
- }else if(indexPath.section==1){
- return 44;
- }else{
- return 44;
- }
- return 0;
-
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- return 10;
- }
- -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
- UIView *header = [[UIView alloc]init];
- header.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1];
- return header;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- static NSString *cellId = @"cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
- if (!cell) {
- cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
- }
- cell.preservesSuperviewLayoutMargins = false;
- cell.separatorInset = UIEdgeInsetsZero;
- cell.layoutMargins = UIEdgeInsetsZero;
- if (indexPath.section==0){
- cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;
- cell.imageView.image = [UIImage imageNamed:@"hsh_user_push"];
- cell.textLabel.text = @"推送管理";
- }else if(indexPath.section ==1){
- cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;
- NSArray *images = @[@"hsh_user_we",@"hsh_user_agreement",@"hsh_user_agreement"];
- NSArray *titles = @[@"关于我们",@"用户协议",@"隐私政策"];
- cell.imageView.image = [UIImage imageNamed:images[indexPath.row]];
- cell.textLabel.text = titles[indexPath.row];
- }else{
- UILabel *quitLabel = [[UILabel alloc]init];
- quitLabel.frame = CGRectMake(0, 0, self.view.frame.size.width, 44);
- quitLabel.textAlignment = NSTextAlignmentCenter;
- [cell.contentView addSubview:quitLabel];
- quitLabel.text = @"退出登录";
- quitLabel.textColor = [UIColor redColor];
- }
-
- return cell;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];//反选
-
- switch (indexPath.section) {
- case 0:
- {
- PushManage_VC *pushVC = [[PushManage_VC alloc]init];
- pushVC.hidesBottomBarWhenPushed =YES;
- [self.navigationController pushViewController:pushVC animated:YES];
- } break;
- case 1:
- {
- if (indexPath.row==0) {
- About_VC *aboutVC = [[About_VC alloc]init];
- aboutVC.hidesBottomBarWhenPushed =YES;
- [self.navigationController pushViewController:aboutVC animated:YES];
- }else if(indexPath.row==1){
- //用户协议
- Protcol_VC *proVC = [[Protcol_VC alloc]init];
- proVC.hidesBottomBarWhenPushed =YES;
- [self.navigationController pushViewController:proVC animated:YES];
- }else{
- // //隐私条款
- privacy_VC *pri = [[privacy_VC alloc]init];
- pri.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:pri animated:YES];
- }
- } break;
- case 2:
- {
- //退出登录
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"你确定要退出当前账户吗?" preferredStyle:UIAlertControllerStyleAlert];
- [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
- [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [DataSourceManager setLoginoutWithUrlcompletionBlock:^(NSDictionary *dic) {
- // //删除alias
- // [JPUSHService deleteAlias:^(NSInteger iResCode, NSString *iAlias, NSInteger seq) {
- // } seq:[self seq]];
- //退出
- UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[UserLogin_VC alloc] init]];
- [UIApplication sharedApplication].keyWindow.rootViewController = nav;
- }];
- //删除alias
- // [JPUSHService deleteAlias:^(NSInteger iResCode, NSString *iAlias, NSInteger seq) {
- // } seq:[self seq]];
- //退出
- UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[UserLogin_VC alloc] init]];
- [UIApplication sharedApplication].keyWindow.rootViewController = nav;
-
- }]];
- [self presentViewController:alert animated:YES completion:nil];
-
- } break;
-
- default:
- break;
- }
-
- }
- - (NSInteger)seq {
- return ++ seq;
- }
- - (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
|