博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IOS - 设置与帮助界面
阅读量:4634 次
发布时间:2019-06-09

本文共 9244 字,大约阅读时间需要 30 分钟。

设置与帮助

改动头像, 改动password, 移动客服, 帮助, 声明, 关于我们.


代码

////  IndexSetting600ViewController.h//  SymptomChecker////  Created by wang on 2015-7-21.////#import "CYTableViewController.h"@interface IndexSetting600ViewController : CYTableViewController@end
////  IndexSetting600ViewController.m//  SymptomChecker////  Created by wang on 2015-7-21.////#import "IndexSetting600ViewController.h"#import "UserCenter600Item.h"#import "UserInfoEditingItem.h" // 改动头像#import "PortraitPickerViewController.h" // 照片视图#import "ModifyPasswordViewController.h" // 改动password#import "LocalPasswordViewController.h"#import "CYWebFromLocalViewController.h" // 帮助/声明#import "CYAboutUsViewController.h" // 关于我们#define kViewRadio viewWidth()/320@interface IndexSetting600ViewController () 
@end@implementation IndexSetting600ViewController {
UserFigureEditingItem *_figureItem; // 改动头像 PortraitPickerViewController *_portraitPickerViewController; // 改动头像视图 Setting600Item *_changeSecret; // 改动登录password Setting600Item *_chunyuTel; // 移动客服 Setting600Item *_helpItem; // 帮助 Setting600Item *_shengMing; // 声明 Setting600Item *_aboutUs; // 关于我们 Setting600SeparateItem *_separateItem; // 空白切割cell FilledColorButton *_logoutButton; // 注销button UIView *_logoutFooterView;}- (id) initWithQuery:(NSDictionary *)query { self = [super initWithQuery: query]; if (self) { self.title = @"设置与帮助"; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(createModel) name:kRegisterLocalPassword object:nil]; } return self;}- (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self];}- (void) viewDidLoad { [super viewDidLoad]; [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; [self createTableItems]; // 确保item已经创建出来}- (void) viewWillAppear:(BOOL)animated { [super viewWillAppear: animated];}//// 创建一次仅仅需//- (void) createTableItems { CY_DEFINE_SELF_BAR(self); User* user = [User currentUser]; // 改动头像 _figureItem = [[UserFigureEditingItem alloc] initWithTitle:@"头像" value:[user.matPhoto getMediaUrl]]; [self.tableViewActions attachToObject:_figureItem tapBlock:^BOOL(id object, id target, NSIndexPath *indexPath) { [_self editUserFigure]; return YES; }]; // 改动登录password _changeSecret = [[Setting600Item alloc] initWithTitle: @"改动登录password"]; _changeSecret.type = kSetting600Top; [self.tableViewActions attachToObject: _changeSecret tapBlock:^BOOL(id object, id target, NSIndexPath *indexPath) { ModifyPasswordViewController *controller = [ModifyPasswordViewController new]; [_self cyPresentViewController:controller animated:YES]; return NO; }]; // 移动客服 _chunyuTel = [[Setting600Item alloc] initWithTitle: @"移动客服"]; _chunyuTel.type = kSetting600Middle; [self.tableViewActions attachToObject: _chunyuTel tapBlock: ^BOOL(id object, id target, NSIndexPath *indexPath) { NSString* feedBackPhoneNumber = @"4001100866"; [[UIApplication sharedApplication] openURL:[NSURL URLWithString: [NSString stringWithFormat: @"tel://%@", feedBackPhoneNumber]]]; return YES; }]; // 帮助 _helpItem = [[Setting600Item alloc] initWithTitle: @"帮助"]; _helpItem.type = kSetting600Middle; [self.tableViewActions attachToObject: _helpItem tapBlock: ^BOOL(id object, id target, NSIndexPath *indexPath) { CYWebFromLocalViewController* controller = [[CYWebFromLocalViewController alloc] initWithQuery:@{@"title" : @"帮助", @"local_name" : @"help"}]; [self.navigationController pushViewController:controller animated:YES]; return YES; }]; // 声明 _shengMing = [[Setting600Item alloc] initWithTitle: @"声明"]; _shengMing.type = kSetting600Middle; [self.tableViewActions attachToObject:_shengMing tapBlock:^BOOL(id object, id target, NSIndexPath *indexPath) { CYWebFromLocalViewController* controller = [[CYWebFromLocalViewController alloc] initWithQuery:@{@"title" : @"声明", @"local_name" : @"statement"}]; [self.navigationController pushViewController:controller animated:YES]; return YES; }]; // 关于我们 _aboutUs = [[Setting600Item alloc] initWithTitle: @"关于我们"]; _aboutUs.type = kSetting600Bottom; [self.tableViewActions attachToObject:_aboutUs tapBlock:^BOOL(id object, id target, NSIndexPath *indexPath) { CYAboutUsViewController* controller = [[CYAboutUsViewController alloc] initWithQuery:@{@"title" : @"关于我们", @"local_name" : @"about"}]; [self.navigationController pushViewController:controller animated:YES]; return YES; }]; // 切割 _separateItem = [[Setting600SeparateItem alloc] init]; // 底部视图 _logoutFooterView = [UIView viewWithFrame:CGRectMake(0, 0, self.view.width, 92*kViewRadio) andBkColor:[UIColor clearColor]]; self.tableView.tableFooterView = _logoutFooterView; // 版本号信息 UILabel *versionLabel = [UILabel labelWithFrame:CGRectMake(0, 8*kViewRadio, viewWidth(), 12*kViewRadio) fontSize:11 fontColor:RGBCOLOR_HEX(0x522121) text:[NSString stringWithFormat: @"当前版本号 :%@", @"1.0.0"] ]; [versionLabel setTextAlignment:NSTextAlignmentCenter]; [_logoutFooterView addSubview:versionLabel]; CGRect logoutRect = CGRectMake(16*kViewRadio, versionLabel.bottom+16*kViewRadio, viewWidth()-32*kViewRadio, 44*kViewRadio); // 注销button _logoutButton = [[FilledColorButton alloc] initWithFrame: logoutRect color: RGBCOLOR_HEX(0xe85454) highlightedColor: RGBCOLOR_HEX(0xa43939) textColor: [UIColor whiteColor] title: @"注销" fontSize: 16*kViewRadio isBold: YES]; [_logoutButton addTarget: self action: @selector(onLogOutBtnpressed:) forControlEvents: UIControlEventTouchUpInside]; [_logoutFooterView addSubview:_logoutButton];}- (void)editUserFigure { _portraitPickerViewController = [[PortraitPickerViewController alloc] initWithParent:self]; _portraitPickerViewController.delegate = self; [_portraitPickerViewController showOptions];}- (void) createModel { NSArray *dataItems; if ([User hasLoggedIn]) { dataItems = @[_separateItem, _figureItem, // 改动头像 _separateItem, _changeSecret,// 改动登录password _chunyuTel, // 移动客服 _helpItem, // 帮助 _shengMing, // 声明 _aboutUs, // 关于我们 _separateItem]; } else { _logoutButton.hidden = YES; _logoutFooterView.height = 40; dataItems = @[_separateItem, _chunyuTel, // 移动客服 _helpItem, // 帮助 _shengMing, // 声明 _aboutUs, // 关于我们 _separateItem]; } self.tableViewModel = [[NITableViewModel alloc] initWithListArray:dataItems delegate:self.cellFactory];}#pragma mark - btn-selectors// 点击注销- (void) onLogOutBtnpressed:(UIButton*) sender { NIDPRINTMETHODNAME(); // 登出 [[AutoLoginManager sharedInstance] logout]; // 更新当前的界面 [self createModel]; [self backToLastController: nil]; // 让别的地方改变UI [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationUserLogout object:nil]; // 获取未登录的badge [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationCheckBadge object:nil];}@end

效果

效果


娱乐

转载于:https://www.cnblogs.com/claireyuancy/p/7097190.html

你可能感兴趣的文章
25个iptables常用示例
查看>>
react-navigation
查看>>
【DSP开发】C6000非多核非KeyStone系列DSP中断系统
查看>>
Ubuntu下如何解压缩zip,tar,tar.gz,tar.bz2文件
查看>>
Jenkins实现SVN+Maven+Java项目的持续集成
查看>>
Java:全局变量(成员变量)与局部变量
查看>>
101
查看>>
2014-01-04 SQL练习
查看>>
Android 悬浮窗口
查看>>
封装了一套WeCenter的IOS SDK
查看>>
Linux 用户行为日志记录
查看>>
SpringBoot学习之启动方式
查看>>
Linux Centos 7 安装配置nginx
查看>>
Java学习笔记---字符类型
查看>>
SQL Server Extended Events 进阶 3:使用Extended Events UI
查看>>
Python3中对Dict的内存优化
查看>>
软件行业项目经理主要的职责是什么?(转)
查看>>
git笔记
查看>>
Java 内部类
查看>>
maven nexus 3 third party 构件上传
查看>>