密码找回界面

#import "AppDelegate.h"

 

@interface AppDelegate ()

 

@end

 

@implementation AppDelegate

 

- (void)dealloc

{

    [_window release];

    [super dealloc];

}

 

 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    // Override point for customization after application launch.

    self.window.backgroundColor = [UIColor whiteColor];

 

    // ***密码找回界面***

    //创建 RegistViewController 对象

    RegistViewController *rootVC = [[RegistViewController alloc]init];

    // 设置为 window 的根视图控制器

    self.window.rootViewController = rootVC;

    // 释放

    [rootVC release];

    

    [self.window makeKeyAndVisible];

    return YES;

}

 

 

 

 

 

#import "RegistViewController.h"

 

@interface RegistViewController ()

 

@end

 

@implementation RegistViewController

 

 

- (void)loadView {

    RegistView *passwordView = [[RegistView alloc]initWithFrame:[[UIScreen mainScreen]bounds]];

    self.view = passwordView;

    [passwordView release];

}

 

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view.

    self.view.backgroundColor = [UIColor orangeColor];

   

    // 密码找回输入框

    ((RegistView *)self.view).textField.placeholder = @"☆请输入电子邮箱★";

    ((RegistView *)self.view).textField.clearButtonMode = UITextFieldViewModeAlways;

    ((RegistView *)self.view).textField.delegate = self;

 

    // 设置属性

    ((RegistView *)self.view).getBackButton.backgroundColor = [UIColor magentaColor];

    [((RegistView *)self.view).getBackButton setTitle:@"找回" forState:(UIControlStateNormal)];

    [((RegistView *)self.view).getBackButton setTitle:@"☺☺☺" forState:(UIControlStateHighlighted)];

    [((RegistView *)self.view).getBackButton setTitle:@"◕◕" forState:(UIControlStateSelected)];

    // 点击 找回 按钮 功能

    [((RegistView *)self.view).getBackButton addTarget:self action:@selector(Dzyx:) forControlEvents:UIControlEventTouchUpInside];

 

    // 设置属性

    ((RegistView *)self.view).cancelButton.backgroundColor = [UIColor brownColor];

    [((RegistView *)self.view).cancelButton setTitle:@"取消" forState:(UIControlStateNormal)];

    [((RegistView *)self.view).cancelButton setTitle:@"☺☺☺" forState:(UIControlStateHighlighted)];

    [((RegistView *)self.view).cancelButton setTitle:@"◕◕" forState:(UIControlStateSelected)];

    // 点击 取消 按钮 功能

    [((RegistView *)self.view).cancelButton addTarget:self action:@selector(QXZC:) forControlEvents:UIControlEventTouchUpInside];

 

    

    // 点击键盘上的 return 按钮时,收回键盘。

    ((RegistView *)self.view).textField.delegate = self;

    

}

 

- (void)Dzyx:(UIButton *)button {

    NSLog(@"发送电子邮件");

    

    // 点击 button 键盘回收

    button.selected = !button.selected;

    [button resignFirstResponder];

    [self.view endEditing:YES];

}

 

- (void)QXZC:(UIButton *)button {

    NSLog(@"返回登陆界面");

    

    // 点击 button 键盘回收

    button.selected = !button.selected;

    [button resignFirstResponder];

    [self.view endEditing:YES];

}

 

 

 

// 点击 return 按钮时,收回键盘。

- (BOOL)textFieldShouldReturn:(UITextField *)textField

{

    [textField resignFirstResponder];

    return YES;

}

 

 

 

 

 

 

#import <UIKit/UIKit.h>

 

@interface RegistView : UIView

 

@property(nonatomic,retain,readonly)UITextField *textField; //找回密码输入框

 

@property(nonatomic,retain,readonly)UIButton *getBackButton;    //找回按钮

@property(nonatomic,retain,readonly)UIButton *cancelButton;    //取消按钮

 

@end

 

 

 

 

 

#import "RegistView.h"

 

@implementation RegistView

 

- (void)dealloc

{

    [_textField release];

    [super dealloc];

}

 

 

 

- (instancetype)initWithFrame:(CGRect)frame

{

    self = [super initWithFrame:frame];

    if (self) {

        

        UIImage *temp = [UIImage imageNamed:@"14.JPG"];

        UIImageView *temp2 = [[UIImageView alloc]initWithImage:temp];

        temp2.frame = [[UIScreen mainScreen] bounds];

        [self addSubview:temp2];

        

        

        _textField = [[UITextField alloc]initWithFrame:CGRectMake(40, 180, 300, 40)];

        _textField.borderStyle = UITextBorderStyleRoundedRect;

        [self addSubview:_textField];

        

        // 密码找回确认按钮

        _getBackButton = [UIButton buttonWithType:UIButtonTypeCustom];

        _getBackButton.frame = CGRectMake(50, 230, 80, 40);

        [_getBackButton setTitle:@"找回" forState:UIControlStateNormal];

        [self addSubview:_getBackButton];

 

        // 密码找回取消按钮

        _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];

        _cancelButton.frame = CGRectMake(250, 230, 80, 40);

        [_cancelButton setTitle:@"取消" forState:UIControlStateNormal];

        [self addSubview:_cancelButton];

        

    }

    return self;

}

 

 

/*

// Only override drawRect: if you perform custom drawing.

// An empty implementation adversely affects performance during animation.

- (void)drawRect:(CGRect)rect {

    // Drawing code

}

*/

 

@end

 

 

 

 

 

 

 

posted @ 2015-08-23 16:15  Hooy星  阅读(340)  评论(0编辑  收藏  举报