| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107 |
- //
- // MMMessageVerificationVC.m
- // MingMen
- //
- // Created by 罗云飞 on 2017/3/11.
- // Copyright © 2017年 罗云飞. All rights reserved.
- //
- #import "NewRegisterViewController.h"
- #import "NewRegistCell.h"
- #import "AgreementViewController.h"
- @interface NewRegisterViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
- {
- NSMutableArray *dataArray;
- UITableView *mainTableView;
- UITextField *phoneTextField;
- UITextField *verificationCodeTextField;
- UITextField *recommendCodeTextField;
- UITextField *passWord1TextField;
- UITextField *passWord2TextField;
- UIButton *verificationCodeButton;
- UITextField *mynametextField;
- UIButton *selectedBtn;
- BOOL isProtocolRule;//技淘注册协议
- UITextField *UnitnameTextField;//单位名称输入框
- UILabel *unitname;//固定
- UILabel *contacts;//联系人名称固定
- UITextField *contactsTextField;//联系人名称输入框
- UIButton *confirm;//注册
- UIButton *confirm2;//注册
- UIView *protocolRuleBar;//注册勾选协议
- UIView *protocolRuleBar2;//注册勾选协议2
- UILabel *line2;
- UILabel *line;
- NSString *type;//类别 个人or企业 0-个人 1-单位
- NSString *yonghutype;
-
-
- }
- @property (strong ,nonatomic) UITextField * account;
- @property (strong ,nonatomic) UITextField * iphoneNumber;
- @property (strong ,nonatomic) UITextField * yanzhenma;
- @property (strong ,nonatomic) UITextField * Customer;
- @property (strong ,nonatomic) UITextField * password;
- @property (strong ,nonatomic) UITextField * querenpassword;
- @property (strong ,nonatomic) UIButton * yhtypeStr;
- @end
- @implementation NewRegisterViewController
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- //关闭侧滑返回功能
- // self.fd_interactivePopDisabled=YES;
- [self.navgationBar setHidden:YES];
- }
- - (void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- [self.navgationBar setHidden:NO];
- }
- -(void)dealloc
- {
- NSLog(@"注册界面销毁");
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self setNavTitle:@"立即注册"];
- isProtocolRule = YES;
- yonghutype = @"请选择用户类型";
- [self loadUI];
- // [self dataInitialization];
- // [self loadsView];
- }
- - (void)loadUI{
- UIImageView *backimage = [UIImageView new];
- [backimage setImage:[UIImage imageNamed:@"dlbj"]];
- backimage.backgroundColor = NewClearColor;
- backimage.userInteractionEnabled = YES;
- [self.view addSubview:backimage];
-
- backimage.sd_layout
- .leftEqualToView(self.view)
- .topEqualToView(self.view)
- .bottomEqualToView(self.view)
- .rightEqualToView(self.view);
-
- UIButton *fanhuiBT = [UIButton new];
- [fanhuiBT setBackgroundImage:NewImageNamed(@"fh") forState:UIControlStateNormal];
- NewTouchUpInside(fanhuiBT, fanhuiBTclick:);
- [backimage addSubview:fanhuiBT];
-
- if (NavHeader == 88) {
- fanhuiBT.sd_layout
- .leftSpaceToView(backimage, 17)
- .topSpaceToView(backimage, 52)
- .heightIs(21)
- .widthIs(11);
- }else{
- fanhuiBT.sd_layout
- .leftSpaceToView(backimage, 17)
- .topSpaceToView(backimage, 32)
- .heightIs(21)
- .widthIs(11);
- }
-
- UIImageView *logoimage = [UIImageView new];
- [logoimage setImage:[UIImage imageNamed:@"logo"]];
- logoimage.backgroundColor = NewClearColor;
- [backimage addSubview:logoimage];
-
- logoimage.sd_layout
- .centerXEqualToView(backimage)
- .topSpaceToView(backimage, fitScreenHeight(90))
- .heightIs(fitScreenWidth(80))
- .widthIs(fitScreenWidth(80));
-
- //用户名
- UIView *usernameview = [UIView new];
- usernameview.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
- usernameview.userInteractionEnabled = YES;
- ViewRadius(usernameview, 5);
- // [backimage addSubview:usernameview];
-
- usernameview.sd_layout
- .leftSpaceToView(backimage, 45)
- .rightSpaceToView(backimage, 45)
- .heightIs(45)
- .topSpaceToView(logoimage, fitScreenHeight(65));
-
- UIImageView *usernameimage = [UIImageView new];
- [usernameimage setImage:[UIImage imageNamed:@"yh"]];
- [usernameimage setBackgroundColor:NewClearColor];
- [usernameview addSubview:usernameimage];
-
- usernameimage.sd_layout
- .centerYEqualToView(usernameview)
- .leftSpaceToView(usernameview, 15)
- .heightIs(16)
- .widthIs(16);
-
- [usernameview addSubview:self.account];
- _account.sd_layout
- .leftSpaceToView(usernameimage, 15)
- .heightIs(30)
- .centerYEqualToView(usernameview)
- .rightSpaceToView(usernameview, 15);
-
- //手机号码
- UIView *iponeNumView = [UIView new];
- iponeNumView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
- iponeNumView.userInteractionEnabled = YES;
- ViewRadius(iponeNumView, 5);
- [backimage addSubview:iponeNumView];
-
- iponeNumView.sd_layout
- .leftSpaceToView(backimage, 45)
- .rightSpaceToView(backimage, 45)
- .heightIs(fitScreenWidth(45))
- .topSpaceToView(logoimage, fitScreenHeight(65));
-
- UIImageView *iponeNumimage = [UIImageView new];
- [iponeNumimage setImage:[UIImage imageNamed:@"sj"]];
- [iponeNumimage setBackgroundColor:NewClearColor];
- [iponeNumView addSubview:iponeNumimage];
-
- iponeNumimage.sd_layout
- .centerYEqualToView(iponeNumView)
- .leftSpaceToView(iponeNumView, 15)
- .heightIs(20)
- .widthIs(17);
-
- [iponeNumView addSubview:self.iphoneNumber];
- _iphoneNumber.sd_layout
- .leftSpaceToView(iponeNumimage, 15)
- .heightIs(30)
- .centerYEqualToView(iponeNumimage)
- .rightSpaceToView(iponeNumView, 15);
-
- //验证码
- UIView *yanzhenmaView = [UIView new];
- yanzhenmaView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
- yanzhenmaView.userInteractionEnabled = YES;
- ViewRadius(yanzhenmaView, 5);
- // [backimage addSubview:yanzhenmaView];
-
- yanzhenmaView.sd_layout
- .leftSpaceToView(backimage, 45)
- .rightSpaceToView(backimage, 45)
- .heightIs(fitScreenWidth(45))
- .topSpaceToView(iponeNumView, 15);
-
- UIImageView *yanzhenmaimage = [UIImageView new];
- [yanzhenmaimage setImage:[UIImage imageNamed:@"yz"]];
- [yanzhenmaimage setBackgroundColor:NewClearColor];
- [yanzhenmaView addSubview:yanzhenmaimage];
-
- yanzhenmaimage.sd_layout
- .centerYEqualToView(yanzhenmaView)
- .leftSpaceToView(yanzhenmaView, 15)
- .heightIs(20)
- .widthIs(18);
-
- [yanzhenmaView addSubview:self.yanzhenma];
- self.yanzhenma.sd_layout
- .leftSpaceToView(yanzhenmaimage, 15)
- .heightIs(30)
- .centerYEqualToView(yanzhenmaimage)
- .rightSpaceToView(yanzhenmaView, 80);
-
- verificationCodeButton = [UIButton new];
- [verificationCodeButton setTitle:@"获取验证码" forState:UIControlStateNormal];
- [verificationCodeButton setTitleColor:[UIColor colorWithString:@"#2987DE"] forState:UIControlStateNormal];
- verificationCodeButton.titleLabel.font = NewFont(fitScreenWidth(13));
- verificationCodeButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
- NewTouchUpInside(verificationCodeButton, touchVerificationCode:);
- [yanzhenmaView addSubview:verificationCodeButton];
-
- verificationCodeButton.sd_layout
- .centerYEqualToView(yanzhenmaView)
- .rightSpaceToView(yanzhenmaView, 10)
- .heightIs(15)
- .widthIs(80);
-
- //客户名称
- UIView *CustomernameView = [UIView new];
- CustomernameView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
- CustomernameView.userInteractionEnabled = YES;
- ViewRadius(CustomernameView, 5);
- // [backimage addSubview:CustomernameView];
-
- CustomernameView.sd_layout
- .leftSpaceToView(backimage, 45)
- .rightSpaceToView(backimage, 45)
- .heightIs(fitScreenWidth(45))
- .topSpaceToView(yanzhenmaView, 15);
-
- UIImageView *Customernameimage = [UIImageView new];
- [Customernameimage setImage:[UIImage imageNamed:@"khxm-min"]];
- // [Customernameimage setBackgroundColor:NewRedColor];
- [CustomernameView addSubview:Customernameimage];
-
- Customernameimage.sd_layout
- .centerYEqualToView(CustomernameView)
- .leftSpaceToView(CustomernameView, 15)
- .heightIs(19)
- .widthIs(16);
-
- [CustomernameView addSubview:self.Customer];
- _Customer.sd_layout
- .leftSpaceToView(Customernameimage, 15)
- .heightIs(30)
- .centerYEqualToView(Customernameimage)
- .rightSpaceToView(CustomernameView, 15);
-
- //第一次密码
- UIView *passwordView = [UIView new];
- passwordView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
- passwordView.userInteractionEnabled = YES;
- ViewRadius(passwordView, 5);
- [backimage addSubview:passwordView];
-
- passwordView.sd_layout
- .leftSpaceToView(backimage, 45)
- .rightSpaceToView(backimage, 45)
- .heightIs(fitScreenWidth(45))
- .topSpaceToView(iponeNumView, 15);
-
- UIImageView *passwordimage = [UIImageView new];
- [passwordimage setImage:[UIImage imageNamed:@"mm"]];
- [passwordimage setBackgroundColor:NewClearColor];
- [passwordView addSubview:passwordimage];
-
- passwordimage.sd_layout
- .centerYEqualToView(passwordView)
- .leftSpaceToView(passwordView, 15)
- .heightIs(19)
- .widthIs(16);
-
- [passwordView addSubview:self.password];
- _password.sd_layout
- .leftSpaceToView(passwordimage, 15)
- .heightIs(30)
- .centerYEqualToView(passwordimage)
- .rightSpaceToView(passwordView, 15);
-
- //第二次密码
- UIView *querenpasswordView = [UIView new];
- querenpasswordView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
- querenpasswordView.userInteractionEnabled = YES;
- ViewRadius(querenpasswordView, 5);
- [backimage addSubview:querenpasswordView];
-
- querenpasswordView.sd_layout
- .leftSpaceToView(backimage, 45)
- .rightSpaceToView(backimage, 45)
- .heightIs(fitScreenWidth(45))
- .topSpaceToView(passwordView, 15);
-
- UIImageView *querenpasswordimage = [UIImageView new];
- [querenpasswordimage setImage:[UIImage imageNamed:@"qr"]];
- [querenpasswordimage setBackgroundColor:NewClearColor];
- [querenpasswordView addSubview:querenpasswordimage];
-
- querenpasswordimage.sd_layout
- .centerYEqualToView(querenpasswordView)
- .leftSpaceToView(querenpasswordView, 15)
- .heightIs(19)
- .widthIs(16);
-
- [querenpasswordView addSubview:self.querenpassword];
- _querenpassword.sd_layout
- .leftSpaceToView(querenpasswordimage, 15)
- .heightIs(30)
- .centerYEqualToView(querenpasswordimage)
- .rightSpaceToView(querenpasswordView, 15);
-
- UIView *yhtypeView = [UIView new];
- yhtypeView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
- yhtypeView.userInteractionEnabled = YES;
- ViewRadius(yhtypeView, 5);
- // [backimage addSubview:yhtypeView];
-
- yhtypeView.sd_layout
- .leftSpaceToView(backimage, 45)
- .rightSpaceToView(backimage, 45)
- .heightIs(fitScreenWidth(45))
- .topSpaceToView(querenpasswordView, 15);
-
- UIImageView *yhtype = [UIImageView new];
- [yhtype setImage:[UIImage imageNamed:@"用户类型"]];
- [yhtype setBackgroundColor:NewClearColor];
- [yhtypeView addSubview:yhtype];
-
- yhtype.sd_layout
- .centerYEqualToView(yhtypeView)
- .leftSpaceToView(yhtypeView, 15)
- .heightIs(19)
- .widthIs(16);
-
- _yhtypeStr = [UIButton new];
- [_yhtypeStr setTitle:yonghutype forState:UIControlStateNormal];
- [_yhtypeStr setTitleColor:[UIColor colorWithString:@"#9A9A9A"] forState:UIControlStateNormal];
- _yhtypeStr.titleLabel.font = NewFont(fitScreenWidth(12));
- NewTouchUpInside(_yhtypeStr, yhbuttoncilck);
- _yhtypeStr.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- [yhtypeView addSubview:_yhtypeStr];
-
- self.yhtypeStr.sd_layout
- .leftSpaceToView(yhtype, 15)
- .heightIs(30)
- .centerYEqualToView(yhtype)
- .rightSpaceToView(yhtypeView, 15);
-
- [backimage addSubview:protocolRuleBar = [NewControlPackage protocolRuleBarInitWithFrame:CGRectMake(0, 0, 0, 0) title:@"接受技淘网用户协议" textColor:NewNavigationColor textAlignment:UIControlContentHorizontalAlignmentLeft font:fitScreenWidth(13) backgroundColor:NewWhiteColor backgroundImage:NewImageNamed(@"未选中状态") backgroundImageSelected:NewImageNamed(@"选中") target:self action:@selector(registrationBTclick:) hidden:NO agreeBTTag:155 agreementBTTag:156 userInteractionEnabled:YES]];
-
- protocolRuleBar.sd_layout
- .leftSpaceToView(backimage, fitScreenWidth(50))
- .topSpaceToView(querenpasswordView, 15)
- .widthIs(SCREEN_WIDTH)
- .heightIs(30);
-
- [backimage addSubview:confirm2 = [NewControlPackage buttonInitWithTitle:@"注 册" Frame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewButtonColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(14) tag:105 target:self action:@selector(touchConfirm) hidden:NO userInteractionEnabled:YES]];
- ViewRadius(confirm2, 8);
-
- confirm2.sd_layout
- .leftEqualToView(querenpasswordView)
- .topSpaceToView(protocolRuleBar, 20)
- .heightIs(40)
- .rightEqualToView(querenpasswordView);
-
- }
- - (UITextField *)account
- {
- if (!_account)
- {
- _account = [UITextField new];
- [_account setBackgroundColor:[UIColor clearColor]];
- [_account setTextColor:NewGrayColor];
- [_account setPlaceholder:@"请输入用户名"];
- [_account setText:@""];
- [_account setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
- [_account setSecureTextEntry:NO];
- [_account setKeyboardType:UIKeyboardTypeNumberPad];
- [_account setReturnKeyType:UIReturnKeyDefault];
- [_account addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- }
- return _account;
- }
- - (UITextField *)Customer
- {
- if (!_Customer)
- {
- _Customer = [UITextField new];
- [_Customer setBackgroundColor:[UIColor clearColor]];
- [_Customer setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
- [_Customer setPlaceholder:@"请输入客户名称"];
- [_Customer setText:@""];
- [_Customer setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
- [_Customer setSecureTextEntry:NO];
- [_Customer setKeyboardType:UIKeyboardTypeDefault];
- [_Customer setReturnKeyType:UIReturnKeyDefault];
- [_Customer addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- }
- return _Customer;
- }
- - (UITextField *)password
- {
- if (!_password)
- {
- _password = [UITextField new];
- [_password setBackgroundColor:[UIColor clearColor]];
- [_password setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
- [_password setPlaceholder:@"请输入密码"];
- [_password setText:@""];
- [_password setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
- [_password setSecureTextEntry:YES];
- [_password setKeyboardType:UIKeyboardTypeDefault];
- [_password setReturnKeyType:UIReturnKeyDefault];
- [_password addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- }
- return _password;
- }
- - (UITextField *)yanzhenma
- {
- if (!_yanzhenma)
- {
- _yanzhenma = [UITextField new];
- [_yanzhenma setBackgroundColor:[UIColor clearColor]];
- [_yanzhenma setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
- [_yanzhenma setPlaceholder:@"请输入验证码"];
- [_yanzhenma setText:@""];
- [_yanzhenma setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
- [_yanzhenma setSecureTextEntry:NO];
- [_yanzhenma setKeyboardType:UIKeyboardTypeDefault];
- [_yanzhenma setReturnKeyType:UIReturnKeyDefault];
- [_yanzhenma addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- }
- return _yanzhenma;
- }
- - (UITextField *)iphoneNumber
- {
- if (!_iphoneNumber)
- {
- _iphoneNumber = [UITextField new];
- [_iphoneNumber setBackgroundColor:[UIColor clearColor]];
- [_iphoneNumber setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
- [_iphoneNumber setPlaceholder:@"请输入手机号"];
- [_iphoneNumber setText:@""];
- [_iphoneNumber setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
- [_iphoneNumber setSecureTextEntry:NO];
- [_iphoneNumber setKeyboardType:UIKeyboardTypeDefault];
- [_iphoneNumber setReturnKeyType:UIReturnKeyDefault];
- [_iphoneNumber addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- }
- return _iphoneNumber;
- }
- - (UITextField *)querenpassword
- {
- if (!_querenpassword)
- {
- _querenpassword = [UITextField new];
- [_querenpassword setBackgroundColor:[UIColor clearColor]];
- [_querenpassword setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
- [_querenpassword setPlaceholder:@"请输入邀请码"];
- [_querenpassword setText:@""];
- [_querenpassword setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
- [_querenpassword setSecureTextEntry:YES];
- [_querenpassword setKeyboardType:UIKeyboardTypeDefault];
- [_querenpassword setReturnKeyType:UIReturnKeyDefault];
- [_querenpassword addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- }
- return _querenpassword;
- }
- #pragma mark - 数据初始化
- -(void)dataInitialization
- {
- phoneTextField = nil;
- verificationCodeTextField = nil;
- recommendCodeTextField = nil;
- verificationCodeButton = nil;
- passWord1TextField = nil;
- passWord2TextField = nil;
- dataArray = NewMutableArrayInit;
- type = @"0";
- isProtocolRule = YES;
- for (int i=0; i<4; i++) {
- NSDictionary *dataDic = [NSDictionary dictionary];
- switch (i) {
- case 0:
- dataDic = @{@"nameKey":@"手机号码",@"imageKey":@"手机号码",@"placeholderKey":@""};
- [dataArray addObject:dataDic];
- break;
- case 1:
- dataDic = @{@"nameKey":@"验证码",@"imageKey":@"短信",@"placeholderKey":@"请输入短信验证码"};
- [dataArray addObject:dataDic];
- break;
- case 2:
- dataDic = @{@"nameKey":@"设置密码",@"imageKey":@"密码",@"placeholderKey":@"密码不少于6位数"};
- [dataArray addObject:dataDic];
- break;
- case 3:
- dataDic = @{@"nameKey":@"确认密码",@"imageKey":@"密码",@"placeholderKey":@"密码不少于6位数"};
- [dataArray addObject:dataDic];
- break;
- default:
- break;
- }
- }
- }
- #pragma mark - UI初始化
- -(void)loadsView
- {
- [self.view addSubview:mainTableView = [NewControlPackage tableViewInitWithFrame:CGRectMake(0, ViewStartY, SCREEN_WIDTH, SCREEN_HEIGHT-ViewStartY) backgroundColor:NewClearColor style:0 delegate:self dataSource:self showsHorizontalScrollIndicator:NO showsVerticalScrollIndicator:NO hidden:NO tag:100 userInteractionEnabled:YES]];
- mainTableView.separatorStyle = NO; //newtableView隐藏线条
-
- UIView *view;
- mainTableView.tableFooterView = view = [NewControlPackage viewInitWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 400) backgroundColor:NewClearColor hidden:NO tag:101 userInteractionEnabled:YES];
-
- UIImageView *lineImge;
- [view addSubview:lineImge = [NewControlPackage imageViewInitWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-15, .6) image:nil highlightedImage:nil backgroundColor:NewCellLineColor tag:102 hidden:YES userInteractionEnabled:YES]];
-
-
- UILabel *personal = [UILabel new];
- personal.text = @"个 人";
- personal.textColor = NewBlackColor;
- personal.font = NewFont(fitScreenWidth(12));
- [personal setSingleLineAutoResizeWithMaxWidth:0];
- [view addSubview:personal];
-
- personal.sd_layout
- .rightSpaceToView(view, SCREEN_WIDTH/2+20)
- .topSpaceToView(lineImge, 30)
- .heightIs(20);
-
- UIButton *personalBT = [UIButton new];
- [personalBT setImage:[UIImage imageNamed:@"未选中状态"] forState:UIControlStateNormal];
- [personalBT setImage:[UIImage imageNamed:@"选中"] forState:UIControlStateSelected];
- personalBT.selected = YES;
- selectedBtn = personalBT;
- NewTouchUpInside(personalBT, personalBTclick:);
- personalBT.tag = 100;
- [view addSubview:personalBT];
-
- personalBT.sd_layout
- .rightSpaceToView(personal, 5)
- .topSpaceToView(lineImge, 30)
- .heightIs(20)
- .widthIs(20);
-
- //企业
- UIButton *enterpriseBT = [UIButton new];
- [enterpriseBT setImage:[UIImage imageNamed:@"未选中状态"] forState:UIControlStateNormal];
- [enterpriseBT setImage:[UIImage imageNamed:@"选中"] forState:UIControlStateSelected];
- enterpriseBT.tag = 101;
- NewTouchUpInside(enterpriseBT, personalBTclick:);
- [view addSubview:enterpriseBT];
-
- enterpriseBT.sd_layout
- .leftSpaceToView(view, SCREEN_WIDTH/2+20)
- .topSpaceToView(lineImge, 30)
- .heightIs(20)
- .widthIs(20);
-
- UILabel *enterprise = [UILabel new];
- enterprise.text = @"企 业";
- enterprise.textColor = NewBlackColor;
- enterprise.font = NewFont(fitScreenWidth(12));
- [enterprise setSingleLineAutoResizeWithMaxWidth:0];
- [view addSubview:enterprise];
-
- enterprise.sd_layout
- .leftSpaceToView(enterpriseBT, 5)
- .topEqualToView(enterpriseBT)
- .heightIs(20);
- //您的姓名
- [view addSubview:mynametextField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewBlackColor placeholder:@"您的姓名" hidden:NO tag:200 font:NewFont(fitScreenWidth(14)) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
- [mynametextField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
-
- mynametextField.sd_layout
- .leftSpaceToView(view, 30)
- .topSpaceToView(enterprise, 20)
- .widthIs(200)
- .heightIs(35);
-
- line = [UILabel new];
- line.backgroundColor = NewLineGrayColor;
- [view addSubview:line];
-
- line.sd_layout
- .leftEqualToView(mynametextField)
- .topSpaceToView(mynametextField, 1)
- .heightIs(0.8)
- .rightSpaceToView(view, 30);
-
- [view addSubview:confirm = [NewControlPackage buttonInitWithTitle:@"注 册" Frame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewButtonColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(fitScreenWidth(14)) tag:105 target:self action:@selector(touchConfirm) hidden:NO userInteractionEnabled:YES]];
- ViewRadius(confirm, 8);
-
- confirm.sd_layout
- .leftEqualToView(mynametextField)
- .topSpaceToView(line, 20)
- .heightIs(40)
- .rightSpaceToView(view, 15);
- // //注册勾选按钮
- [view addSubview:protocolRuleBar = [NewControlPackage protocolRuleBarInitWithFrame:CGRectMake(0, 0, 0, 0) title:@"注册即视为同意用户协议" textColor:NewNavigationColor textAlignment:UIControlContentHorizontalAlignmentLeft font:fitScreenWidth(13) backgroundColor:NewWhiteColor backgroundImage:NewImageNamed(@"未选中状态") backgroundImageSelected:NewImageNamed(@"选中") target:self action:@selector(registrationBTclick:) hidden:NO agreeBTTag:155 agreementBTTag:156 userInteractionEnabled:YES]];
-
- protocolRuleBar.sd_layout
- .leftSpaceToView(view, fitScreenWidth(50))
- .topSpaceToView(confirm, 20)
- .widthIs(SCREEN_WIDTH)
- .heightIs(20);
-
-
- unitname = [UILabel new];
- unitname.text = @"单位名称";
- unitname.font = NewFont(14);
- unitname.textColor = [UIColor colorWithString:@"#3C3C3C"];
- [unitname setSingleLineAutoResizeWithMaxWidth:0];
- [view addSubview:unitname];
-
- unitname.sd_layout
- .leftSpaceToView(view, 30)
- .topSpaceToView(personalBT, 30)
- .heightIs(15);
-
- //单位名称
- [view addSubview:UnitnameTextField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewBlackColor placeholder:@"请输入单位名称" hidden:NO tag:220 font:NewFont(14) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
- [UnitnameTextField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
-
- UnitnameTextField.sd_layout
- .leftSpaceToView(unitname, 15)
- .topSpaceToView(enterprise, 20)
- .widthIs(200)
- .heightIs(35);
-
- contacts = [UILabel new];
- contacts.text = @"联系人名称";
- contacts.textColor = NewBlackColor;
- contacts.font = NewFont(14);
- [contacts setSingleLineAutoResizeWithMaxWidth:0];
- [view addSubview:contacts];
-
- contacts.sd_layout
- .leftEqualToView(unitname)
- .topSpaceToView(line, 27)
- .heightIs(15);
-
- //联系人名称输入框
- [view addSubview:contactsTextField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewBlackColor placeholder:@"请输入联系人名称" hidden:NO tag:221 font:NewFont(14) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
- [contactsTextField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
-
- contactsTextField.sd_layout
- .leftSpaceToView(contacts, 15)
- .topSpaceToView(line, 27)
- .widthIs(200)
- .heightIs(15);
-
- line2 = [UILabel new];
- line2.backgroundColor = [UIColor colorWithString:@"eaeaea"];
- [view addSubview:line2];
-
- line2.sd_layout
- .leftEqualToView(contacts)
- .topSpaceToView(contactsTextField, 10)
- .heightIs(0.8)
- .rightSpaceToView(view, 30);
-
-
- [view addSubview:confirm2 = [NewControlPackage buttonInitWithTitle:@"注 册" Frame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewButtonColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(14) tag:105 target:self action:@selector(touchConfirm) hidden:NO userInteractionEnabled:YES]];
- ViewRadius(confirm2, 8);
-
- confirm2.sd_layout
- .leftEqualToView(contacts)
- .topSpaceToView(line2, 30)
- .heightIs(40)
- .rightSpaceToView(view, 15);
-
- // //注册勾选按钮
-
- [view addSubview:protocolRuleBar2 = [NewControlPackage protocolRuleBarInitWithFrame:CGRectMake(0, 0, 0, 0) title:@"注册即视为同意用户协议" textColor:[UIColor colorWithString:@"#9A9A9A"] textAlignment:UIControlContentHorizontalAlignmentLeft font:fitScreenWidth(14) backgroundColor:NewWhiteColor backgroundImage:NewImageNamed(@"未选中状态") backgroundImageSelected:NewImageNamed(@"选中") target:self action:@selector(registrationBTclick:) hidden:NO agreeBTTag:155 agreementBTTag:156 userInteractionEnabled:YES]];
-
- protocolRuleBar2.sd_layout
- .leftSpaceToView(view, 0)
- .topSpaceToView(confirm2, 20)
- .widthIs(SCREEN_WIDTH)
- .heightIs(20);
-
-
- unitname.hidden = YES;
- UnitnameTextField.hidden = YES;
-
- contactsTextField.hidden = YES;
- contacts.hidden = YES;
- line2.hidden = YES;
-
- confirm2.hidden = YES;
- protocolRuleBar2.hidden = YES;
-
- }
- #pragma mark - UITableView Delegate
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return dataArray.count;
- }
- - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- static NSString *Cell = @"Cell";
- NewRegistCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell];
- if (cell == nil) {
- cell = [[NewRegistCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell];
- }
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
-
- cell.image.image = NewImageNamed(dataArray[indexPath.row][@"imageKey"]);
- cell.title.text = dataArray[indexPath.row][@"nameKey"];
-
- if (passWord2TextField == nil) {
-
- //获取验证码frame
- float vcwidth = 66;
- float vcheight = cell.height-20;
- float vcx = SCREEN_WIDTH-vcwidth-20;
- float vcy = 10;
-
-
- UITextField *textField;
- [cell.contentView addSubview:textField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewGrayColor placeholder:dataArray[indexPath.row][@"placeholderKey"] hidden:NO tag:100+(int)indexPath.row font:NewFont(fitScreenWidth(13)) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
- [textField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
- textField.sd_layout
- .leftSpaceToView(cell.contentView, 110)
- .heightIs(fitScreenWidth(25))
- .centerYEqualToView(cell.title)
- .rightSpaceToView(cell.contentView, 30);
-
- if (indexPath.row == 0) {
- cell.areacode.hidden = NO;
- }else{
- cell.areacode.hidden = YES;
- }
-
- if (indexPath.row==0) {
- phoneTextField = textField;
- textField.sd_layout
- .leftSpaceToView(cell.contentView, 140)
- .heightIs(fitScreenWidth(25))
- .centerYEqualToView(cell.title)
- .rightSpaceToView(cell.contentView, 30);
- [textField setKeyboardType:UIKeyboardTypeNumberPad];
- }else if (indexPath.row==1) {
- verificationCodeTextField = textField;
-
- [cell.contentView addSubview:verificationCodeButton = [NewControlPackage buttonInitWithTitle:@"获取验证码" Frame:CGRectMake(vcx, vcy, vcwidth, vcheight) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewLightGrayColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(fitScreenWidth(11)) tag:99 target:self action:@selector(touchVerificationCode:) hidden:NO userInteractionEnabled:YES]];
- // ViewRadius(verificationCodeButton, 10);
-
- verificationCodeButton.sd_layout
- .rightSpaceToView(cell.contentView, 30)
- .heightIs(fitScreenWidth(25))
- .bottomSpaceToView(cell.contentView, 5)
- .widthIs(fitScreenWidth(66));
-
- }else if (indexPath.row==2) {
- passWord1TextField = textField;
- [passWord1TextField setSecureTextEntry:YES];
-
- }else if (indexPath.row==3) {
- passWord2TextField = textField;
- [passWord2TextField setSecureTextEntry:YES];
- }
- }
- return cell;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return fitScreenWidth(44);
- }
- #pragma mark - 作字符输入限制
- - (void)textFieldEditingChanged:(UITextField *)textField
- {
- /*
- @property (strong ,nonatomic) UITextField * account;
- @property (strong ,nonatomic) UITextField * iphoneNumber;
- @property (strong ,nonatomic) UITextField * yanzhenma;
- @property (strong ,nonatomic) UITextField * Customer;
- @property (strong ,nonatomic) UITextField * password;
- @property (strong ,nonatomic) UITextField * querenpassword;
- */
- if (textField == self.iphoneNumber) {
- if ([textField.text length]>11) {
- textField.text=[textField.text substringToIndex:11];//手机号码11位
- }
- }else if (textField == self.yanzhenma) {
- if ([textField.text length]>6) {
- textField.text=[textField.text substringToIndex:6];//验证码4位
- }
- }else if (textField == self.account) {
- if ([textField.text length]>6) {
- textField.text=[textField.text substringToIndex:6];//用户名
- }
- }else if (textField == self.password) {
- if ([textField.text length]>20) {
- textField.text=[textField.text substringToIndex:20];//第一次密码最多20位
- }
- }else if (textField == self.querenpassword) {
- if ([textField.text length]>20) {
- textField.text=[textField.text substringToIndex:20];//第二次密码最多20位
- }
- }else if (textField == self.Customer){
- if ([textField.text length]>6) {
- textField.text=[textField.text substringToIndex:6];//客户名称
- }
- }
- }
- #pragma mark - 获取验证码
- - (void)touchVerificationCode:(UIButton *)sender
- {
- if (![self verification:@"校验手机号"]) {
- return;
- }
- [MBProgressHUD showLoadToView:self.view title:@"请稍后..."];
- NSMutableDictionary *parameters = NewMutableDictionaryInit;
- [parameters safeSetObject:self.iphoneNumber.text forKey:@"mobile"];//手机号码
- [NetworkRequestManager requestGetWithInterfacePrefix:JT_getAppMCode parameters:parameters onSuccess:^(id requestdict) {
- [MBProgressHUD hideHUDForView:self.view];
- if ([requestdict[@"error"] count] !=0) {
- for (NSDictionary *dic in requestdict[@"error"]) {
- [MBProgressHUD showError:dic[@"message"] toView:self.view];
- verificationCodeButton.sd_layout
- .widthIs(fitScreenWidth(66));
- }
- }else{
- verificationCodeButton.sd_layout
- .widthIs(fitScreenWidth(100));
- [MBProgressHUD showSuccess:@"短信已发送" toView:self.view];
- sender.frame = CGRectMake(sender.left, sender.top, 80, sender.height);
- [self verificationCode:60 sender:sender];
- }
- } onFailure:^{
- [MBProgressHUD hideHUDForView:self.view];
- }];
- }
- - (void)verificationCode:(NSInteger)code sender:(UIButton *)sender{
- NSString *str=[NSString stringWithFormat:@"%d秒后重新发送",(int)code];
- [sender setTitle:str forState:UIControlStateNormal];
- sender.enabled=NO;
- if (code==0) {
- sender.enabled=YES;
- [sender setTitle:@"获取验证码" forState:UIControlStateNormal];
- sender.frame = CGRectMake(sender.left, sender.top, 66, sender.height);
- return;
- }
- code--;
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self verificationCode:code sender:sender];
- });
- }
- #pragma mark - 注册按钮
- - (void)touchConfirm
- {
- NSMutableDictionary *parameters = NewMutableDictionaryInit;
- if (!isProtocolRule) {
- [self.view makeToast:@"请同意勾选用户协议" duration:1.0 position:CSToastPositionCenter];
- return;
- }
- if (self.iphoneNumber.text.length<=0 || self.iphoneNumber.text.length < 11) {
- [MBProgressHUD showError:@"请填写正确的手机号码" toView:self.view];
- return;
- }else if (self.password.text.length<=0 || self.password.text.length<6){
- [MBProgressHUD showError:@"请填写密码,密码长度且大于6位数" toView:self.view];
- return;
- }else{
- [MBProgressHUD showSuccess:@"恭喜您,注册成功!入驻发布信息,请联系平台管理员激活账户" toView:self.view];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- NewPopViewController;
- });
- }
- return;
- // if (![self verification:@"个人注册"]) {
- // return;
- // }
- // if ([yonghutype isEqualToString:@"请选择用户类型"]) {
- // [MBProgressHUD showError:@"请先选择用户类型" toView:self.view];
- // return;
- // }
- [MBProgressHUD showLoadToView:self.view title:@"请稍后..."];
- [parameters safeSetObject:self.iphoneNumber.text forKey:@"mobile"];//手机号
- [parameters safeSetObject:self.password.text forKey:@"password"];//密码
- [parameters safeSetObject:self.yanzhenma.text forKey:@"mobileCode"];//短信验证码
- [parameters safeSetObject:@"" forKey:@"unitName"];//客户名称
- // if ([yonghutype isEqualToString:@"个人"]) {
- [parameters safeSetObject:@"0" forKey:@"type"];//
- // }else if ([yonghutype isEqualToString:@"企业"]){
- // [parameters safeSetObject:@"1" forKey:@"type"];//您的姓名
- // }
- [parameters safeSetObject:self.querenpassword.text forKey:@"beInviteCode"];//邀请码
- [NetworkRequestManager requestPostWithInterfacePrefix:JT_register parameters:parameters onSuccess:^(id requestData) {
- [MBProgressHUD hideHUDForView:self.view];
- if ([requestData[@"error"] count] !=0) {
- for (NSDictionary *dic in requestData[@"error"]) {
- [MBProgressHUD showError:dic[@"message"] toView:self.view];
- }
- }else{
- [MBProgressHUD showSuccess:@"注册成功" toView:self.view];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- NewPopViewController;
- });
- }
- } onFailure:^{
- [MBProgressHUD hideHUDForView:self.view];
- }];
- };
- - (BOOL)verification:(NSString *)status
- {
- if ([status isEqualToString:@"校验手机号"]) {
- if (self.iphoneNumber.text.length <= 0) {
- [self.view makeToast:@"请输入手机号码" duration:1.0 position:CSToastPositionCenter];
- return NO;
- }else if (self.iphoneNumber.text.length < 11){
- [self.view makeToast:@"手机号码输入有误" duration:1.0 position:CSToastPositionCenter];
- return NO;
- }
-
- }else if([status isEqualToString:@"个人注册"]){
- if (self.iphoneNumber.text.length < 11) {
- [self.view makeToast:@"手机号码输入有误" duration:1.5 position:CSToastPositionCenter];
- return NO;
- }
- if (self.yanzhenma.text.length <= 0) {
- [self.view makeToast:@"验证码输入有误" duration:1.5 position:CSToastPositionCenter];
- return NO;
- }
- if (self.Customer.text.length<=0) {
- [self.view makeToast:@"客户名称输入有误" duration:1.5 position:CSToastPositionCenter];
- return NO;
- }
- if (self.password.text.length<6||self.querenpassword.text.length<6) {
- [self.view makeToast:@"新密码不能少于6位数" duration:1.5 position:CSToastPositionCenter];
- return NO;
- }
- if (self.password.text.length < 6) {
- [self.view makeToast:@"新密码输入有误" duration:1.5 position:CSToastPositionCenter];
- return NO;
- }
- if (self.querenpassword.text.length < 6) {
- [self.view makeToast:@"确认新密码输入有误" duration:1.5 position:CSToastPositionCenter];
- return NO;
- }
- if (![self.password.text isEqualToString:self.querenpassword.text]) {
- [self.view makeToast:@"设置密码和确认密码不同" duration:1.5 position:CSToastPositionCenter];
- return NO;
- }
- // if (self.account.text.length<=0) {
- // [self.view makeToast:@"用户名输入有误" duration:1.5 position:CSToastPositionCenter];
- // return NO;
- // }
- }
- return YES;
- }
- #pragma mark ---- 点击个人或企业按钮------
- - (void)personalBTclick:(UIButton *)sender {
- if (sender != selectedBtn)
- {
- selectedBtn.selected = NO;
- selectedBtn = sender;
- }
- selectedBtn.selected = YES;
- NSLog(@"%ld",sender.tag);
- if (sender.tag == 100) {
- NSLog(@"个人");
- type = @"0";
- unitname.hidden = YES;
- UnitnameTextField.hidden = YES;
- mynametextField.hidden = NO;
-
- contactsTextField.hidden = YES;
- contacts.hidden = YES;
- line2.hidden = YES;
-
- //注册按钮
- confirm.hidden = NO;
- confirm2.hidden = YES;
- //勾选协议按钮
- protocolRuleBar.hidden = NO;
- protocolRuleBar2.hidden = YES;
-
-
- }else{
- NSLog(@"企业");
- type = @"1";
- unitname.hidden = NO;
- UnitnameTextField.hidden = NO;
- mynametextField.hidden = YES;
-
- contactsTextField.hidden = NO;
- contacts.hidden = NO;
- line2.hidden = NO;
-
- //注册按钮
- confirm.hidden = YES;
- confirm2.hidden = NO;
- //勾选协议按钮
- protocolRuleBar.hidden = YES;
- protocolRuleBar2.hidden = NO;
-
-
- }
- }
- #pragma mark ---- 点击注册协议勾选按钮 ------
- - (void)registrationBTclick:(UIButton *)sender {
- if (sender.tag == 155) {
- sender.selected = !sender.selected;
-
- if (!sender.selected) {
- NSLog(@"同意协议");
- isProtocolRule = YES;
- }else {
- NSLog(@"不同意协议");
- isProtocolRule = NO;
- }
-
- }else if (sender.tag == 156) {
- NSLog(@"点击协议规则");
- NewInitWithName(AgreementViewController, vc);
- vc.str = @"注册协议";
- NewPushViewController(vc);
-
- }
- }
- - (void)fanhuiBTclick:(UIButton *)sender {
- NewPopViewController;
- }
- -(void)yhbuttoncilck
- {
- UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:@"用户类型" message:@"请选择用户类型" preferredStyle:UIAlertControllerStyleActionSheet];
- // 创建action,这里action1只是方便编写,以后再编程的过程中还是以命名规范为主
- UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"个人" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- yonghutype = @"个人";
- [_yhtypeStr setTitle:yonghutype forState:UIControlStateNormal];
- }];
- UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"企业" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- yonghutype = @"企业";
- [_yhtypeStr setTitle:yonghutype forState:UIControlStateNormal];
- }];
- UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-
- }];
-
- //把action添加到actionSheet里
- [actionSheet addAction:action1];
- [actionSheet addAction:action2];
- [actionSheet addAction:action3];
-
- //相当于之前的[actionSheet show];
- [self presentViewController:actionSheet animated:YES completion:nil];
- }
- - (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
|