| | |
| | | #import "SettingController.h" |
| | | #import "StorageSpaceTableViewCell.h" |
| | | #import "SettingWebView.h" |
| | | #import "UIView+Toast.h" |
| | | |
| | | #define indentfly @"cell" |
| | | #define indentfly1 @"Mcell" |
| | | #define indentfly2 @"WIFIcell" |
| | | #define indentfly_logout @"LogoutCell" |
| | | #define indentfly_unregister @"UnregisterCell" |
| | | |
| | | @interface SettingController()<UITableViewDelegate,UITableViewDataSource>{ |
| | | BOOL _userOnLine; |
| | |
| | | @implementation SettingController |
| | | |
| | | - (void)viewWillAppear:(BOOL)animated { |
| | | _userOnLine=[[NSUserDefaults standardUserDefaults] boolForKey:@"userOnLine"]; |
| | | if(_mytableview){ |
| | | [_mytableview reloadData]; |
| | | } |
| | | [super viewWillAppear:animated]; |
| | | [self.navigationController setNavigationBarHidden:NO animated:animated]; |
| | | } |
| | |
| | | [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"buUserInfo"]; |
| | | [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"userOnLine"]; |
| | | [[NSUserDefaults standardUserDefaults] synchronize]; |
| | | |
| | | [[NSNotificationCenter defaultCenter] postNotificationName:@"RELOAD_DATA" object:nil]; |
| | | [self.navigationController popViewControllerAnimated:YES]; |
| | | } |
| | | |
| | | // 注销 |
| | | -(void)unRegister{ |
| | | NSString *link= [[NSUserDefaults standardUserDefaults] stringForKey:UNREGISTER_LINK]; |
| | | |
| | | if(link&&![link isEqual:@""]) |
| | | { |
| | | NSLog(@"注销"); |
| | | SettingWebView *settingWebViewController = [[SettingWebView alloc] init]; |
| | | settingWebViewController.webTitle=@"账号注销"; |
| | | settingWebViewController.requestURL=link; |
| | | [self.navigationController pushViewController:settingWebViewController animated:YES]; |
| | | }else{ |
| | | [self.view makeToast:@"尚未获取到注销链接"]; |
| | | } |
| | | } |
| | | |
| | | - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { |
| | |
| | | |
| | | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ |
| | | if(_userOnLine){ |
| | | if (section==3) { |
| | | if (section==3||section==4) { |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | |
| | | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ |
| | | if (_userOnLine) { |
| | | return _dataAry.count+1; |
| | | return _dataAry.count+2; |
| | | } |
| | | return _dataAry.count; |
| | | } |
| | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ |
| | | if(section==0){ |
| | | return 30; |
| | | }else if(section==3){ |
| | | }else if(section==3||section==4){ |
| | | return 0; |
| | | } |
| | | return 22; |
| | |
| | | return cell; |
| | | |
| | | }else if(indexPath.section==3){ |
| | | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentfly]; |
| | | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentfly_logout]; |
| | | if (cell==nil) { |
| | | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indentfly]; |
| | | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indentfly_logout]; |
| | | [cell setAccessoryType:UITableViewCellAccessoryNone]; |
| | | } |
| | | |
| | |
| | | [outButton setTitle:@"退出登录" forState:UIControlStateNormal]; |
| | | [outButton setTintColor:[UIColor whiteColor]]; |
| | | [outButton addTarget:self action:@selector(OutOfLogin) forControlEvents:UIControlEventTouchUpInside]; |
| | | [cell.viewForLastBaselineLayout addSubview:outButton]; |
| | | |
| | | return cell; |
| | | }else if(indexPath.section==4){ |
| | | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentfly_unregister]; |
| | | if (cell==nil) { |
| | | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indentfly_unregister]; |
| | | [cell setAccessoryType:UITableViewCellAccessoryNone]; |
| | | } |
| | | |
| | | UIButton *outButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, KScreenW, 44)]; |
| | | [outButton setBackgroundColor:[UIColor whiteColor]]; |
| | | // [outButton setBackgroundColor:kGlobalBlueColor]; |
| | | [outButton setTitle:@"注销账号" forState:UIControlStateNormal]; |
| | | [outButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; |
| | | [outButton setTintColor:[UIColor grayColor]]; |
| | | [outButton addTarget:self action:@selector(unRegister) forControlEvents:UIControlEventTouchUpInside]; |
| | | [cell.viewForLastBaselineLayout addSubview:outButton]; |
| | | |
| | | return cell; |
| | |
| | | if(indexPath.section == 3 && indexPath.row == 0) { |
| | | [self OutOfLogin]; |
| | | } |
| | | if(indexPath.section == 4 && indexPath.row == 0) { |
| | | [self unRegister]; |
| | | } |
| | | } |
| | | |
| | | - (void)popTips { |