仿拉钩传值(17-08-08)

//
//  AppDelegate.m
//  lagou
//
//  Created by lanou3g on 17/8/4.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import "AppDelegate.h"
#import "RootViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    RootViewController *rootViewController = [[RootViewController alloc] init];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    self.window.rootViewController = navigationController;
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end

//
//  RootViewController.m
//  lagou
//
//  Created by lanou3g on 17/8/4.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import "RootViewController.h"
#import "UIImage+FEBoxBlur.h"
#import "MyInputView.h"
#import "SetupViewController.h"
#import "RemberViewController.h"

@interface RootViewController () <SetupViewControllerDelegate>

@property (nonatomic,retain) UIImage *image;
@property (nonatomic,retain) UIImageView *imageView;
@property (nonatomic,retain) MyInputView *myinputView;

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationController.navigationBar.translucent = YES;
    self.navigationController.navigationBarHidden = YES;
    self.view.backgroundColor = [UIColor whiteColor];
    [self configImageTwo];

    UIImageView *topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_lagou.png"]];
    CGFloat width = 110;
    CGFloat height = 180;
    topImageView.frame = CGRectMake((self.view.frame.size.width - width) / 2, 120, width, height);
    [self.view addSubview:topImageView];

    self.myinputView = [[MyInputView alloc] initWithFrame:CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 320, self.view.frame.size.width-20, 82)];
    self.myinputView.layer.cornerRadius = 8.f;
    self.myinputView.layer.masksToBounds = YES;
    [self.view addSubview:self.myinputView];
    

    UIBarButtonItem *backIetm = [[UIBarButtonItem alloc] init];
    backIetm.title = @"返回";
    self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1];
    self.navigationItem.backBarButtonItem = backIetm;

    
//    UITextField *textFieldName = [[UITextField alloc] initWithFrame:CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 320, self.view.frame.size.width-20, 41)];
//    textFieldName.borderStyle = UITextBorderStyleRoundedRect;
//    [textFieldName setBackgroundColor:[UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.25]];
//    textFieldName.tag = 1005;
//    [textFieldName addTarget:self action:@selector(textFieldAction:) forControlEvents: UIControlEventTouchDown];
//    [textFieldName addTarget:self action:@selector(textFieldAction1:) forControlEvents: UIControlEventEditingDidEnd];
//    [self.view addSubview:textFieldName];
//    
//    UIImageView *leftView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 41, 41)];
//    leftView.backgroundColor = [UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.5];
//    leftView.image = [UIImage imageNamed:@"icon_username.png"];
//    textFieldName.leftView = leftView;
//    textFieldName.leftViewMode = UITextFieldViewModeAlways;
//    leftView.layer.cornerRadius = 5;
//    [textFieldName addTarget:self action:@selector(textFieldAction:) forControlEvents:UIControlEventTouchUpInside];
//    
//    UITextField *textFieldPassWord = [[UITextField alloc] initWithFrame:CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 362.5, self.view.frame.size.width-20, 41)];
//    textFieldPassWord.borderStyle = UITextBorderStyleRoundedRect;
//    [textFieldPassWord setBackgroundColor:[UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.25]];
//    [textFieldPassWord addTarget:self action:@selector(textFieldActionp:) forControlEvents: UIControlEventTouchDown];
//    [textFieldPassWord addTarget:self action:@selector(textFieldActionp1:) forControlEvents: UIControlEventEditingDidEnd];
//    [self.view addSubview:textFieldPassWord];
//    
//    UIImageView *leftView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 41, 41)];
//    leftView1.backgroundColor = [UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.5];
//    leftView1.image = [UIImage imageNamed:@"icon_password.png"];
//    textFieldPassWord.leftView = leftView1;
//    textFieldPassWord.leftViewMode = UITextFieldViewModeAlways;
//    leftView1.layer.cornerRadius = 5;

    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 420, self.view.frame.size.width-20, 35);
    [button setTitle:@"登录" forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize: 16.0];
    button.layer.cornerRadius=5;
    button.layer.masksToBounds = YES;
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal];
    [self.view addSubview:button];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
    button2.frame = CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 470, 70, 30);
    [button2 setTitle:@"忘记密码" forState:UIControlStateNormal];
    button2.titleLabel.font = [UIFont systemFontOfSize: 16.0];
    button2.layer.cornerRadius=5;
    button2.layer.masksToBounds = YES;
    [button2 addTarget:self action:@selector(button2Action:) forControlEvents:UIControlEventTouchUpInside];
    [button2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] init];
//    backButtonItem.title = @"返回";
//    self.navigationItem.backBarButtonItem = backButtonItem;
//    self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1];
    [self.view addSubview:button2];
    
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeSystem];
    button1.frame = CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 525, self.view.frame.size.width-20, 35);
    [button1 setTitle:@"现在注册拉钩" forState:UIControlStateNormal];
    button1.titleLabel.font = [UIFont boldSystemFontOfSize:18];
    button1.layer.cornerRadius=5;
    button1.layer.masksToBounds = YES;
    [button1 setTitleColor: [UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(button1Action:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
    
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0,self.view.bounds.size.height-85, self.view.bounds.size.width/2-30, 1.0f)];
    lineView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:lineView];
    
        UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width)/2-15, 565, 30, 30)];
        label1.text = @" or ";
        label1.font = [UIFont systemFontOfSize:18];
        label1.textColor = [UIColor whiteColor];
        [self.view addSubview:label1];
    
    UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake((self.view.frame.size.width)/2+30,self.view.bounds.size.height-85, self.view.bounds.size.width/2-30, 1.0f)];
    lineView1.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:lineView1];
    
    UIButton *button3 = [UIButton buttonWithType:UIButtonTypeSystem];
    button3.frame = CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 600, self.view.frame.size.width-20, 35);
    [button3 setTitle:@"随便逛逛>" forState:UIControlStateNormal];
    button3.titleLabel.font = [UIFont systemFontOfSize: 16.0];
    button3.layer.cornerRadius=5;
    button3.layer.masksToBounds = YES;
    [button3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.view addSubview:button3];
    
    
}

- (void)button1Action:(UIButton *)button1 {
    SetupViewController *setupViewController = [[SetupViewController alloc] init];
    setupViewController.delegate = self;
    setupViewController.textName = self.myinputView.usernameField.text;
    setupViewController.textPassword = self.myinputView.passwordField.text;
    [self.navigationController pushViewController:setupViewController animated:YES];
    self.navigationController.navigationBarHidden = YES;
}


- (void)getTextField1:(NSString *)text1 TextField2:(NSString *)text2 {
    self.myinputView.usernameField.text = text1;
    self.myinputView.passwordField.text = text2;
}

- (void)button2Action:(UIButton *)button2 {
    RemberViewController *remberViewController = [[RemberViewController alloc] init];
    [self.navigationController pushViewController:remberViewController animated:YES];
    self.navigationController.navigationBarHidden = NO;
}


//-(void)textFieldAction:(UITextField *)textFild{
//    NSString *string = [[NSString alloc] init];
//    string = 10005 == textFild.tag ? @"icon_password_select":@"icon_username_select";
//    UIImageView *leftView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 41, 41)];
//    leftView.backgroundColor = [UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.6];
//    leftView.image = [UIImage imageNamed:string];
//    textFild.leftView = leftView;
//    textFild.leftViewMode = UITextFieldViewModeAlways;
//    leftView.layer.cornerRadius = 5;
//    leftView.layer.masksToBounds = YES;
//    
//}
//-(void)textFieldAction1:(UITextField *)textFild{
//    NSString *string = [[NSString alloc] init];
//    string = 10005 == textFild.tag ? @"icon_password":@"icon_username";
//    UIImageView *leftView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 41, 41)];
//    leftView.backgroundColor = [UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.6];
//    leftView.image = [UIImage imageNamed:string];
//    textFild.leftView = leftView;
//    textFild.leftViewMode = UITextFieldViewModeAlways;
//    leftView.layer.cornerRadius = 5;
//    leftView.layer.masksToBounds = YES;
//    
//}
//
//-(void)textFieldActionp:(UITextField *)textFild{
//    NSString *string = [[NSString alloc] init];
//    string = 10005 == textFild.tag ? @"icon_username_select":@"icon_password_select";
//    UIImageView *leftView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 41, 41)];
//    leftView.backgroundColor = [UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.6];
//    leftView.image = [UIImage imageNamed:string];
//    textFild.leftView = leftView;
//    textFild.leftViewMode = UITextFieldViewModeAlways;
//    leftView.layer.cornerRadius = 5;
//    leftView.layer.masksToBounds = YES;
//    
//    
//}
//-(void)textFieldActionp1:(UITextField *)textFild{
//    NSString *string = [[NSString alloc] init];
//    string = 10005 == textFild.tag ? @"icon_username":@"icon_password";
//    UIImageView *leftView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 41, 41)];
//    leftView.backgroundColor = [UIColor colorWithRed:51/255 green:51/255 blue:51/255 alpha:0.6];
//    leftView.image = [UIImage imageNamed:string];
//    textFild.leftView = leftView;
//    textFild.leftViewMode = UITextFieldViewModeAlways;
//    leftView.layer.cornerRadius = 5;
//    leftView.layer.masksToBounds = YES;
//}

- (UIImage *)image{
    if (!_image) {
        _image=[UIImage imageNamed:@"IMG_3527_meitu_5.jpg"];
    }
    return _image;
}

- (void)configImageTwo{
    self.imageView=[[UIImageView alloc]initWithFrame:self.view.bounds];
    self.imageView.contentMode=UIViewContentModeScaleAspectFill;
    self.imageView.image=[UIImage boxblurImage:self.image withBlurNumber:0.5];
    _imageView.alpha = 0.9;
    self.imageView.clipsToBounds=YES;
    [self.view addSubview:self.imageView];
}

- (void)drawRect:(CGRect)rect {
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineCap(context, kCGLineCapRound);
    CGContextSetLineWidth(context, 3);  //线宽
    CGContextSetAllowsAntialiasing(context, true);
    CGContextSetRGBStrokeColor(context, 70.0 / 255.0, 241.0 / 255.0, 241.0 / 255.0, 1.0);  //线的颜色
    CGContextBeginPath(context);
    
    CGContextMoveToPoint(context, 0, 0);  //起点坐标
    CGContextAddLineToPoint(context, 30, 30);   //终点坐标
    
    CGContextStrokePath(context);
}

- (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

//
//  SetupViewController.h
//  lagou
//
//  Created by lanou3g on 17/8/7.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol SetupViewControllerDelegate <NSObject>

- (void)getTextField1:(NSString *)text1 TextField2:(NSString *)text2;

@end

@interface SetupViewController : UIViewController

@property (nonatomic,retain) UIImage *image;
@property (nonatomic,retain) UIImageView *imageView;
//
@property (nonatomic, retain) NSString *textName;
@property (nonatomic, retain) NSString *textPassword;
@property (nonatomic,assign) id<SetupViewControllerDelegate>delegate;

@end

//
//  SetupViewController.m
//  lagou
//
//  Created by lanou3g on 17/8/7.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import "SetupViewController.h"
#import "MyInputView.h"
#import "UIImage+FEBoxBlur.h"

@interface SetupViewController () 

@property (nonatomic,retain) MyInputView *myinputView2;

@end

@implementation SetupViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self configImageTwo];
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIImageView *topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_lagou.png"]];
    CGFloat width = 110;
    CGFloat height = 180;
    topImageView.frame = CGRectMake((self.view.frame.size.width - width) / 2, 90, width, height);
    [self.view addSubview:topImageView];

    self.myinputView2 = [[MyInputView alloc] initWithFrame:CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 300, self.view.frame.size.width-20, 102)];

    self.myinputView2.userNameImageView.image = [UIImage imageNamed:@"phone1.png"];
    self.myinputView2.userNameImageView.highlightedImage = [UIImage imageNamed:@"phone.png"];
    self.myinputView2.usernameField.placeholder = @" 请输入手机号";
    [self.myinputView2.usernameField setValue:[UIColor grayColor]forKeyPath:@"_placeholderLabel.textColor"];
    [self.myinputView2.usernameField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];
    self.myinputView2.userNameImageView.frame = CGRectMake(0, 0, 50, 50);
    self.myinputView2.passwordImageView.image = [UIImage imageNamed:@"text11.png"];
    self.myinputView2.passwordImageView.highlightedImage = [UIImage imageNamed:@"text.png"];
    self.myinputView2.passwordField.placeholder = @" 请输入验证码";
    [self.myinputView2.passwordField setValue:[UIColor grayColor]forKeyPath:@"_placeholderLabel.textColor"];
    [self.myinputView2.passwordField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];
    self.myinputView2.passwordImageView.frame = CGRectMake(0, 0, 50, 50);
    [self.view addSubview:self.myinputView2];
    
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(0, 0, 100, 30);
    [btn setTitle:@"获取验证码" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont systemFontOfSize:15];
    btn.backgroundColor = [UIColor clearColor];
    
    self.myinputView2.passwordField.rightView = btn;
    self.myinputView2.passwordField.rightViewMode = UITextFieldViewModeAlways;
    
    CGFloat widthed = 225;
    CGFloat heighted = 30;
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width-widthed-20)/2+20, 408, widthed, heighted)];
    UIImageView *imageViewSetup = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"delegate.png"]];
    imageViewSetup.frame = CGRectMake((self.view.frame.size.width-widthed-20)/2, 408, 20, 30);
    [self.view addSubview:imageViewSetup];
    label1.text = @"注册代表你同意拉钩用户协议";
    label1.font = [UIFont boldSystemFontOfSize:16];
    [self.view addSubview:label1];
    NSMutableAttributedString *hintString=[[NSMutableAttributedString alloc]initWithString:label1.text];
    NSRange range1=[[hintString string]rangeOfString:@"注册代表你同意"];
    [hintString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:128.0f/255.0f green:138.0f/255.0f blue:135.0f/255.0f alpha:1] range:range1];
    
    NSRange range2=[[hintString string]rangeOfString:@"拉钩用户协议"];
    [hintString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] range:range2];
    
    label1.attributedText=hintString;
    
    UIButton *buttonSetup = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonSetup.frame = CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 465, self.view.frame.size.width-20, 45);
    [buttonSetup setTitle:@"注册" forState:UIControlStateNormal];
    [buttonSetup setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    buttonSetup.backgroundColor = [UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1];
    buttonSetup.titleLabel.font = [UIFont systemFontOfSize:17];
    buttonSetup.layer.cornerRadius = 3;
    buttonSetup.layer.masksToBounds = YES;
    [buttonSetup addTarget:self action:@selector(buttonBackAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:buttonSetup];
    
    UIButton *buttonBack = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonBack.frame = CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-20))/2, 530, self.view.frame.size.width-20, 45);
    [buttonBack setTitle:@"返回登录" forState:UIControlStateNormal];
    [buttonBack setTitleColor:[UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] forState:UIControlStateNormal];
    buttonBack.backgroundColor = [UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:0.2];
    buttonBack.layer.cornerRadius = 3;
    buttonBack.titleLabel.font = [UIFont systemFontOfSize:17];
    [buttonBack addTarget:self action:@selector(buttonBackAction:) forControlEvents:UIControlEventTouchUpInside];
    
    buttonBack.layer.masksToBounds = YES;
    buttonBack.layer.borderColor = [[UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] CGColor];
    buttonBack.layer.borderWidth = 1.f;
    
    [self.view addSubview:buttonBack];
    
}

//- (void)buttonSetupAction:(UIButton *)buttonSetup {
//    
//}


- (void)buttonBackAction:(UIButton *)buttonSetup {
    
    [self.delegate getTextField1:self.myinputView2.usernameField.text TextField2:self.myinputView2.passwordField.text];
    [self.navigationController popToRootViewControllerAnimated:YES];
    self.navigationController.navigationBarHidden = YES;
}

- (UIImage *)image{
    if (!_image) {
        _image=[UIImage imageNamed:@"IMG_3527_meitu_5.jpg"];
    }
    return _image;
}

- (void)configImageTwo{
    self.imageView=[[UIImageView alloc]initWithFrame:self.view.bounds];
    self.imageView.contentMode=UIViewContentModeScaleAspectFill;
    self.imageView.image=[UIImage boxblurImage:self.image withBlurNumber:0.5];
    _imageView.alpha = 0.9;
    self.imageView.clipsToBounds=YES;
    [self.view addSubview:self.imageView];
}

- (void)drawRect:(CGRect)rect {
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineCap(context, kCGLineCapRound);
    CGContextSetLineWidth(context, 3);  //线宽
    CGContextSetAllowsAntialiasing(context, true);
    CGContextSetRGBStrokeColor(context, 70.0 / 255.0, 241.0 / 255.0, 241.0 / 255.0, 1.0);  //线的颜色
    CGContextBeginPath(context);
    
    CGContextMoveToPoint(context, 0, 0);  //起点坐标
    CGContextAddLineToPoint(context, 30, 30);   //终点坐标
    
    CGContextStrokePath(context);
}




- (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

//
//  RemberViewController.m
//  lagou
//
//  Created by lanou3g on 17/8/7.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import "RemberViewController.h"
#import "textView.h"

@interface RemberViewController ()

@end

@implementation RemberViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.translucent = YES;
    [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
    

    
//    UIButton *backButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 30)];
//    [backButton setTitle:@"返回" forState:UIControlStateNormal];
//    [backButton setTitleColor:[UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] forState:UIControlStateNormal];
//    [backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
//    self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1];
//    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton];

    CGFloat width = 100;
    CGFloat height = 50;
    UILabel *labelTitle = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width-100)/2, 60, width, height)];
    labelTitle.text = @"验证手机";
    labelTitle.textAlignment = NSTextAlignmentCenter;
    labelTitle.font = [UIFont systemFontOfSize:18];
    [self.view addSubview:labelTitle];
    
    textView *textsView = [[textView alloc] initWithFrame:CGRectMake(((self.view.frame.size.width)-(self.view.frame.size.width-40))/2, 120, self.view.frame.size.width-40, 92)];
//    textsView.backgroundColor = [UIColor redColor];
    [self.view addSubview:textsView];
    
    UIButton *nextButton = [UIButton buttonWithType:UIButtonTypeSystem];
    nextButton.frame = CGRectMake((self.view.frame.size.width-(self.view.frame.size.width-40))/2, 240, self.view.frame.size.width-40, 45);
    [nextButton setTitle:@"下一步" forState:UIControlStateNormal];
    nextButton.backgroundColor = [UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1];
    nextButton.layer.cornerRadius = 3;
    nextButton.layer.masksToBounds = YES;
    [nextButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.view addSubview:nextButton];
    
    CGFloat widthed = 225;
    CGFloat heighted = 30;
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width-(self.view.frame.size.width-40))/2, 300, widthed, heighted)];
    label1.text = @"邮箱用户找回密码,请点击这里";
    label1.font = [UIFont boldSystemFontOfSize:14];
    [self.view addSubview:label1];
    NSMutableAttributedString *hintString=[[NSMutableAttributedString alloc]initWithString:label1.text];
    NSRange range1=[[hintString string]rangeOfString:@"邮箱用户找回密码,请"];
    [hintString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:128.0f/255.0f green:138.0f/255.0f blue:135.0f/255.0f alpha:0.3] range:range1];
    
    NSRange range2=[[hintString string]rangeOfString:@"点击这里"];
    [hintString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] range:range2];
    
    label1.attributedText=hintString;
    
    
}

//-(void)backAction{
//    [self.navigationController popViewControllerAnimated:YES];
//    self.navigationController.navigationBarHidden = YES;
//}

- (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

//
//  MyInputView.h
//  lagou
//
//  Created by lanou3g on 17/8/7.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface MyInputView : UIView

@property (nonatomic, retain) UITextField *usernameField;
@property (nonatomic, retain) UITextField *passwordField;
@property (nonatomic, retain) UIImageView *userNameImageView;
@property (nonatomic, retain) UIImageView *passwordImageView;

@end

//
//  MyInputView.m
//  lagou
//
//  Created by lanou3g on 17/8/7.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import "MyInputView.h"

@interface MyInputView () <UITextFieldDelegate>

@end

@implementation MyInputView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        self.userNameImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_username.png"] highlightedImage:[UIImage imageNamed:@"icon_username_select.png"]];
        self.userNameImageView.frame = CGRectMake(0, 0, 40, 40);
        self.userNameImageView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6f];
        
        self.passwordImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_password.png"] highlightedImage:[UIImage imageNamed:@"icon_password_select.png"]];
        self.passwordImageView.frame = CGRectMake(0, 0, 40, 40);
        self.passwordImageView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6f];
        
        self.usernameField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height/2-1)];
        self.usernameField.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
        self.usernameField.clearButtonMode = YES;
        self.usernameField.delegate = self;
        [self addSubview:self.usernameField];
        
        self.passwordField = [[UITextField alloc] initWithFrame:CGRectMake(0, self.usernameField.frame.size.height+2, self.usernameField.frame.size.width, self.usernameField.frame.size.height)];
        self.passwordField.secureTextEntry = YES;
        self.passwordField.clearButtonMode = YES;
        self.passwordField.delegate = self;
        self.passwordField.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
        [self addSubview:self.passwordField];
        
        self.usernameField.leftView = self.userNameImageView;
        self.usernameField.leftViewMode = UITextFieldViewModeAlways;
        [self addSubview:self.userNameImageView];
        
        self.passwordField.leftView = self.passwordImageView;
        self.passwordField.leftViewMode = UITextFieldViewModeAlways;
        [self addSubview:self.passwordImageView];

  
    }
    return self;
}
//代理方法
- (void)textFieldDidBeginEditing:(UITextField *)textField {
    UIImageView *leftView = (UIImageView *)textField.leftView;
    leftView.highlighted = YES;
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    UIImageView *leftView = (UIImageView *)textField.leftView;
    leftView.highlighted = NO;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end

//
//  textView.h
//  lagou
//
//  Created by apple on 2017/8/7.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface textView : UIView

@property (nonatomic, retain) UITextField *phoneNumberTextField;
@property (nonatomic, retain) UITextField *textNumberTextField;
@property (nonatomic, retain) UIImageView *imageView;
@property (nonatomic, retain) UIImageView *imageView1;
@property (nonatomic, retain) UIImageView *phoneNumberImageView;
@property (nonatomic, retain) UIImageView *textNumberImageView;

@end

//
//  textView.m
//  lagou
//
//  Created by apple on 2017/8/7.
//  Copyright © 2017年 lanou3g. All rights reserved.
//

#import "textView.h"

@interface textView () <UITextFieldDelegate>

@end

@implementation textView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.phoneNumberTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height/2 - 1)];
        self.phoneNumberTextField.placeholder = @" 手机号(仅支持中国大陆手机号)";
        self.phoneNumberTextField.font = [UIFont systemFontOfSize:15];
        self.phoneNumberTextField.clearButtonMode = YES;
        self.phoneNumberTextField.delegate = self;
        [self addSubview:self.phoneNumberTextField];
        
        self.textNumberTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, self.phoneNumberTextField.frame.size.height+2, frame.size.width, frame.size.height/2 - 1)];
        self.textNumberTextField.placeholder = @" 验证码";
        self.textNumberTextField.font = [UIFont systemFontOfSize:15];
        self.textNumberTextField.secureTextEntry = YES;
        self.textNumberTextField.clearButtonMode = YES;
        self.textNumberTextField.delegate = self;
        [self addSubview:self.textNumberTextField];
        
        self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.phoneNumberTextField.frame.size.height, frame.size.width, 1)];
        self.imageView.backgroundColor = [UIColor colorWithRed:128.0f/255.0f green:138.0f/255.0f blue:135.0f/255.0f alpha:0.2];
        [self addSubview:self.imageView];
        
        self.imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 93, frame.size.width, 1)];
        self.imageView1.backgroundColor = [UIColor colorWithRed:128.0f/255.0f green:138.0f/255.0f blue:135.0f/255.0f alpha:0.2];
        [self addSubview:self.imageView1];
        
        self.phoneNumberImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"phone1.png"] highlightedImage:[UIImage imageNamed:@"phone.png"]];
        self.phoneNumberImageView.frame = CGRectMake(0, 0, 25, 25);
        self.phoneNumberImageView.backgroundColor = [UIColor whiteColor];
        
        self.textNumberImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"text1.png"] highlightedImage:[UIImage imageNamed:@"text.png"]];
        self.textNumberImageView.frame = CGRectMake(0, 0, 21, 25);
        self.textNumberImageView.backgroundColor = [UIColor whiteColor];
        
        self.phoneNumberTextField.leftView = self.phoneNumberImageView;
        self.phoneNumberTextField.leftViewMode = UITextFieldViewModeAlways;
        [self addSubview:self.phoneNumberImageView];
        self.textNumberTextField.leftView = self.textNumberImageView;
        self.textNumberTextField.leftViewMode = UITextFieldViewModeAlways;
        
        UIButton *textButton = [UIButton buttonWithType:UIButtonTypeSystem];
        textButton.frame = CGRectMake(0, 0, 100, 30);
        [textButton setTitle:@"获取验证码" forState:UIControlStateNormal];
        [textButton setTitleColor:[UIColor colorWithRed:0 green:172.0f/255.0f blue:135.0f/255.0f alpha:1] forState:UIControlStateNormal];
        self.textNumberTextField.rightView = textButton;
        self.textNumberTextField.rightViewMode = UITextFieldViewModeAlways;
        [self addSubview:self.textNumberImageView];
        
    }
    return self;
}

- (void)textFieldDidBeginEditing:(UITextField *)textField {
    UIImageView *leftView = (UIImageView *)textField.leftView;
    leftView.highlighted = YES;
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    UIImageView *leftView = (UIImageView *)textField.leftView;
    leftView.highlighted = NO;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; color: #008400}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; color: #1337ff}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; min-height: 19.0px}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; color: #d12f1b}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; color: #bb2ca2}span.s1 {font-variant-ligatures: no-common-ligatures}span.s2 {font-variant-ligatures: no-common-ligatures; color: #008400}span.s3 {font-variant-ligatures: no-common-ligatures; color: #1337ff}span.s4 {font: 16.0px 'PingFang SC'; font-variant-ligatures: no-common-ligatures}span.s5 {font-variant-ligatures: no-common-ligatures; color: #78492a}span.s6 {font-variant-ligatures: no-common-ligatures; color: #bb2ca2}span.s7 {font-variant-ligatures: no-common-ligatures; color: #703daa}

//
//  UIImage+FEBoxBlur.h
//  iOS-UIImageBoxBlur
//http://indieambitions.com/idevblogaday/perform-blur-vimage-accelerate-framework-tutorial/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+IndieAmbitions+%28Indie+Ambitions%29
//  Created by keso on 16/1/14.
//  Copyright © 2016年 FlyElephant. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Accelerate/Accelerate.h>

@interface UIImage (FEBoxBlur)
/**
 *  CoreImage图片高斯模糊
 *
 *  @param image 图片
 *  @param blur  模糊数值(默认是10)
 *
 *  @return 重新绘制的新图片
 */

+(UIImage *)coreBlurImage:(UIImage *)image withBlurNumber:(CGFloat)blur;
/**
 *  vImage模糊图片
 *
 *  @param image 原始图片
 *  @param blur  模糊数值(0-1)
 *
 *  @return 重新绘制的新图片
 */
+(UIImage *)boxblurImage:(UIImage *)image withBlurNumber:(CGFloat)blur;

@end
//
//  UIImage+FEBoxBlur.m
//  iOS-UIImageBoxBlur
//
//  Created by keso on 16/1/14.
//  Copyright © 2016年 FlyElephant. All rights reserved.
//

#import "UIImage+FEBoxBlur.h"

@implementation UIImage (FEBoxBlur)

+(UIImage *)coreBlurImage:(UIImage *)image
           withBlurNumber:(CGFloat)blur {
    //博客园-FlyElephant
    CIContext *context = [CIContext contextWithOptions:nil];
    CIImage  *inputImage=[CIImage imageWithCGImage:image.CGImage];
    //设置filter
    CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
    [filter setValue:inputImage forKey:kCIInputImageKey];
    [filter setValue:@(blur) forKey: @"inputRadius"];
    //模糊图片
    CIImage *result=[filter valueForKey:kCIOutputImageKey];
    CGImageRef outImage=[context createCGImage:result fromRect:[result extent]];
    UIImage *blurImage=[UIImage imageWithCGImage:outImage];
    CGImageRelease(outImage);
    return blurImage;
}

+(UIImage *)boxblurImage:(UIImage *)image withBlurNumber:(CGFloat)blur {
    if (blur < 0.f || blur > 1.f) {
        blur = 0.5f;
    }
    int boxSize = (int)(blur * 40);
    boxSize = boxSize - (boxSize % 2) + 1;
    
    CGImageRef img = image.CGImage;
    
    vImage_Buffer inBuffer, outBuffer;
    vImage_Error error;
    
    void *pixelBuffer;
    //从CGImage中获取数据
    CGDataProviderRef inProvider = CGImageGetDataProvider(img);
    CFDataRef inBitmapData = CGDataProviderCopyData(inProvider);
    //设置从CGImage获取对象的属性
    inBuffer.width = CGImageGetWidth(img);
    inBuffer.height = CGImageGetHeight(img);
    inBuffer.rowBytes = CGImageGetBytesPerRow(img);
    
    inBuffer.data = (void*)CFDataGetBytePtr(inBitmapData);
    
    pixelBuffer = malloc(CGImageGetBytesPerRow(img) *
                         CGImageGetHeight(img));
    
    if(pixelBuffer == NULL)
        NSLog(@"No pixelbuffer");
    
    outBuffer.data = pixelBuffer;
    outBuffer.width = CGImageGetWidth(img);
    outBuffer.height = CGImageGetHeight(img);
    outBuffer.rowBytes = CGImageGetBytesPerRow(img);
    
    error = vImageBoxConvolve_ARGB8888(&inBuffer, &outBuffer, NULL, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend);
    
    if (error) {
        NSLog(@"error from convolution %ld", error);
    }
    
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextRef ctx = CGBitmapContextCreate(
                                             outBuffer.data,
                                             outBuffer.width,
                                             outBuffer.height,
                                             8,
                                             outBuffer.rowBytes,
                                             colorSpace,
                                             kCGImageAlphaNoneSkipLast);
    CGImageRef imageRef = CGBitmapContextCreateImage (ctx);
    UIImage *returnImage = [UIImage imageWithCGImage:imageRef];
    
    //clean up
    CGContextRelease(ctx);
    CGColorSpaceRelease(colorSpace);
    
    free(pixelBuffer);
    CFRelease(inBitmapData);
    
    CGColorSpaceRelease(colorSpace);
    CGImageRelease(imageRef);
    
    return returnImage;
}

@end

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,589评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,615评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 165,933评论 0 356
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,976评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,999评论 6 393
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,775评论 1 307
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,474评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,359评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,854评论 1 317
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,007评论 3 338
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,146评论 1 351
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,826评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,484评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,029评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,153评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,420评论 3 373
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,107评论 2 356

推荐阅读更多精彩内容