iOS Login Registration Interface jump

Source: Internet
Author: User
Tags uikit

//

ZyAppDelegate.h

EX2

//

Created by Nimami on 15/7/21.

Copyright (c) 2015 LKL. All rights reserved.

//

#import <UIKit/UIKit.h>

@interface Zyappdelegate:uiresponder <UIApplicationDelegate>

@property (Strong, nonatomic) UIWindow *window;

@end

//

Zyappdelegate.m

EX2

//

Created by Nimami on 15/7/21.

Copyright (c) 2015 LKL. All rights reserved.

//

#import "ZyAppDelegate.h"

#import "ZYFirstViewController.h"

#import "ZYSecondViewController.h"

@implementation Zyappdelegate

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions

{

Self.window = [[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];

Self.window.backgroundColor = [Uicolor Whitecolor];

[Self.window makekeyandvisible];

Zyfirstviewcontroller * VC = [[Zyfirstviewcontroller alloc]init];

Self.window.rootViewController = VC;

return YES;

}

-(void) Touchesbegan: (Nsset *) touches withevent: (Uievent *) event

{

[Self.window Endediting:yes];

}

@end

//

ZYFirstViewController.h

EX2

//

Created by Nimami on 15/7/21.

Copyright (c) 2015 zhiyou. All rights reserved.

//

#import <UIKit/UIKit.h>

@interface Zyfirstviewcontroller:uiviewcontroller

@property NSString * backvalue;

@property NSString * BACKPAW;

@end

//

Zyfirstviewcontroller.m

EX2

//

Created by Nimami on 15/7/21.

Copyright (c) 2015 LKL. All rights reserved.

//

#import "ZYFirstViewController.h"

#import "ZYSecondViewController.h"

#import "ZyAppDelegate.h"

@interface Zyfirstviewcontroller ()

@end

@implementation Zyfirstviewcontroller

-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornil

{

self = [super Initwithnibname:nibnameornil Bundle:nibbundleornil];

if (self) {

Custom initialization

}

return self;

}

-(void) viewdidload

{

[Super Viewdidload];

Login interface

UILabel * Usename = [[UILabel alloc]initwithframe:cgrectmake (30, 100, 80, 30)];

Usename.text = @ "user name:";

[Self.view Addsubview:usename];

UILabel * Pswname = [[UILabel alloc]initwithframe:cgrectmake (30, 150, 80, 30)];

Pswname.text = @ "Password:";

[Self.view Addsubview:pswname];

Uitextfield * USETF = [[Uitextfield alloc]initwithframe:cgrectmake (100, 100, 160, 30)];

Usetf.borderstyle = Uitextborderstyleroundedrect;

Usetf.placeholder = @ "Please enter user name:";

NSLog (@ "backvaule%@", _backvalue);

Usetf.text = _backvalue;

[Self.view ADDSUBVIEW:USETF];

Uitextfield * PAWTF = [[Uitextfield alloc]initwithframe:cgrectmake (100, 150, 160, 30)];

Pawtf.borderstyle = Uitextborderstyleroundedrect;

Pawtf.placeholder = @ "Please enter password:";

Pawtf.securetextentry =yes;

NSLog (@ "backpaw%@", _backpaw);

Pawtf.text = _backpaw;

[Self.view ADDSUBVIEW:PAWTF];

UIButton * Usebutton = [UIButton Buttonwithtype:uibuttontypesystem];

Usebutton.frame = CGRectMake (100, 260, 40, 30);

[Usebutton settitle:@ "Login" forstate:uicontrolstatenormal];

[Self.view Addsubview:usebutton];

UIButton * Pswbutton = [UIButton Buttonwithtype:uibuttontypesystem];

Pswbutton.frame = CGRectMake (200, 260, 40, 30);

[Pswbutton settitle:@ "registration" forstate:uicontrolstatenormal];

[Pswbutton addtarget:self Action: @selector (Registerclick) forcontrolevents:uicontroleventtouchupinside];

[Self.view Addsubview:pswbutton];

}

-(void) Registerclick

{

NSLog (@ "-----------------------");

Creating objects

Zysecondviewcontroller * VC = [[Zysecondviewcontroller alloc]init];

Find window

UIApplication * app = [uiapplication sharedapplication];

Zyappdelegate * appdelegate = app.delegate;

Object as the root controller

AppDelegate.window.rootViewController = VC;

}

@end

//

ZYSecondViewController.h

EX2

//

Created by Nimami on 15/7/21.

Copyright (c) 2015 zhiyou. All rights reserved.

//

#import <UIKit/UIKit.h>

@interface Zysecondviewcontroller:uiviewcontroller

@property Uitextfield * USETF1;

@property Uitextfield * PAWTF1;

@property Uitextfield * CONFIRTF1;

@end

//

Zysecondviewcontroller.m

EX2

//

Created by Nimami on 15/7/21.

Copyright (c) 2015 LKL. All rights reserved.

//

#import "ZYSecondViewController.h"

#import "ZYFirstViewController.h"

#import "ZyAppDelegate.h"

@interface Zysecondviewcontroller ()

@end

@implementation Zysecondviewcontroller

-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornil

{

self = [super Initwithnibname:nibnameornil Bundle:nibbundleornil];

if (self) {

}

return self;

}

-(void) viewdidload

{

[Super Viewdidload];

Self.view.backgroundColor = [Uicolor Lightgraycolor];

UILabel * useName1 = [[UILabel alloc]initwithframe:cgrectmake (30, 100, 80, 30)];

Usename1.text = @ "user name:";

[Self.view addsubview:usename1];

UILabel * pswname1= [[UILabel Alloc]initwithframe:cgrectmake (30, 150, 80, 30)];

Pswname1.text = @ "Password:";

[Self.view addsubview:pswname1];

UILabel * confirname1= [[UILabel Alloc]initwithframe:cgrectmake (30, 200, 80, 30)];

Confirname1.text = @ "Confirm password:";

[Self.view addsubview:confirname1];

_USETF1 = [[Uitextfield alloc]initwithframe:cgrectmake (100, 100, 160, 30)];

_usetf1.borderstyle = Uitextborderstyleroundedrect;

_usetf1.placeholder = @ "Please enter user name:";

[Self.view ADDSUBVIEW:_USETF1];

_PAWTF1 = [[Uitextfield alloc]initwithframe:cgrectmake (100, 150, 160, 30)];

_pawtf1.borderstyle = Uitextborderstyleroundedrect;

_pawtf1.placeholder = @ "Please enter password:";

_pawtf1.securetextentry = YES;

[Self.view ADDSUBVIEW:_PAWTF1];

_CONFIRTF1 = [[Uitextfield alloc]initwithframe:cgrectmake (100, 200, 160, 30)];

_confirtf1.borderstyle = Uitextborderstyleroundedrect;

_confirtf1.placeholder = @ "Confirm password:";

_confirtf1.securetextentry = YES;

[Self.view ADDSUBVIEW:_CONFIRTF1];

UIButton * UseButton1 = [UIButton Buttonwithtype:uibuttontypesystem];

Usebutton1.frame = CGRectMake (100, 260, 40, 30);

[UseButton1 settitle:@ "return" forstate:uicontrolstatenormal];

[UseButton1 addtarget:self Action: @selector (Backclick) forcontrolevents:uicontroleventtouchupinside];

[Self.view Addsubview:usebutton1];

UIButton * PswButton1 = [UIButton Buttonwithtype:uibuttontypesystem];

Pswbutton1.frame = CGRectMake (200, 260, 40, 30);

[PswButton1 settitle:@ "submit" forstate:uicontrolstatenormal];

[PswButton1 addtarget:self Action: @selector (click) forcontrolevents:uicontroleventtouchupinside];

[Self.view Addsubview:pswbutton1];

}

-(void) Backclick

{

Zyfirstviewcontroller * VC1 = [[Zyfirstviewcontroller alloc]init];

UIApplication * app = [uiapplication sharedapplication];

Zyappdelegate * appdelegate = app.delegate;

AppDelegate.window.rootViewController = VC1;

}

-(void) Click

{

NSLog (@ "submit was clicked");

if (_usetf1.text.length < 6)

{

NSLog (@ "password less than six bits");

Uialertview * Alertview =[[uialertview alloc]initwithtitle:@ "Warning" message:@ "user name less than six bits" Delegate:nil CancelButtonTitle: Nil otherbuttontitles:@ "OK", nil];

[Alertview show];

Return

}

if (_pawtf1.text.length < 6)

{

Uialertview * Alertview =[[uialertview alloc]initwithtitle:@ "Warning" message:@ "password less than six bits" Delegate:nil CancelButtonTitle:nil otherbuttontitles:@ "OK", nil];

[Alertview show];

Return

}

if ([_pawtf1.text Isequaltostring:_confirtf1.text] ==no)

{

Uialertview * Alertview =[[uialertview alloc]initwithtitle:@ "Warning" message:@ "Password and Confirm password inconsistent!" Delegate:nil Cancelbuttontitle:nil otherbuttontitles:@ "OK", nil];

[Alertview show];

Return

}

Else

{

Uialertview * Alertview =[[Uialertview alloc]initwithtitle:@ "Prompt" message:@ "registered successfully!" Please login! "Delegate:nil cancelButtonTitle: Nil otherbuttontitles:@ "OK", nil];

[Alertview show];

Zyfirstviewcontroller * VC = [[Zyfirstviewcontroller alloc]init];

UIApplication * app = [uiapplication sharedapplication];

Zyappdelegate * appdelegate = app.delegate;

Vc.backvalue = _usetf1.text;

Vc.backpaw = _pawtf1.text;

AppDelegate.window.rootViewController = VC;

}

}

@end

iOS Login Registration Interface jump

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.