// // GiGaUserLoginVC.m // GIGA // // Created by lianxiang on 2018/8/20. // Copyright © 2018年 com.giga.ios. All rights reserved. // #import "GiGaUserLoginVC.h" #import "UINavigationBar+Custom.h" #import "PassWordResetVC.h" #import "GiGaRegistViewController.h" #import "GiGaUserDefault.h" @interface GiGaUserLoginVC () @property (weak, nonatomic) IBOutlet UIImageView *userImagView; @property (weak, nonatomic) IBOutlet UITextField *acountTextField; @property (weak, nonatomic) IBOutlet UITextField *passwordTextField; @property (weak, nonatomic) IBOutlet UIButton *loginBtn; @property (weak, nonatomic) IBOutlet UIButton *weiXinLoginBtn; @property (weak, nonatomic) IBOutlet UIButton *registBtn; @end @implementation GiGaUserLoginVC - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. [self setUpX]; [self textFieldUI]; [self.registBtn addTarget:self action:@selector(registBtnAction) forControlEvents:UIControlEventTouchUpInside]; [self.loginBtn addTarget:self action:@selector(loginBtnAction:) forControlEvents:UIControlEventTouchUpInside]; } -(void)setUpX{ UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; rightBtn.frame = CGRectMake(0, 0, 40, 40); rightBtn.backgroundColor = [UIColor blueColor]; [rightBtn setImage:[UIImage imageNamed:@"maske_dismiss_waring"] forState:UIControlStateNormal]; [rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn]; } -(void)textFieldUI{ [self.acountTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"]; UIView *acountView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; acountView.backgroundColor = [UIColor redColor]; UIImageView *acountViewIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)]; acountViewIcon.image = [UIImage imageNamed:@""]; [acountView addSubview:acountViewIcon]; self.acountTextField.leftView = acountView; self.acountTextField.leftViewMode = UITextFieldViewModeAlways; [self.passwordTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"]; UIView *passView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; passView.backgroundColor = [UIColor redColor]; UIImageView *passViewIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)]; passViewIcon.image = [UIImage imageNamed:@""]; [passView addSubview:passViewIcon]; self.passwordTextField.leftView = passView; self.passwordTextField.leftViewMode = UITextFieldViewModeAlways; self.loginBtn.layer.masksToBounds = YES; self.loginBtn.layer.cornerRadius = self.loginBtn.frame.size.height / 2; self.weiXinLoginBtn.layer.masksToBounds = YES; self.weiXinLoginBtn.layer.cornerRadius = self.weiXinLoginBtn.frame.size.height / 2; } -(void)rightBtnAction{ [self dismissViewControllerAnimated:YES completion:nil]; } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController.navigationBar setClearNav]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)forgetPassBtn:(id)sender { PassWordResetVC *passVC= [[PassWordResetVC alloc] init]; [self.navigationController pushViewController:passVC animated:YES]; } #pragma mark - 去注册 -(void)registBtnAction{ GiGaRegistViewController *registVC = [[GiGaRegistViewController alloc] init]; [self.navigationController pushViewController:registVC animated:YES]; } #pragma mark - 登录 -(void)loginBtnAction:(UIButton *)btn{ [GiGaUserDefault saveUserId:@"123"]; } @end