iOS Login Registration interface Jump (interface operation)

Source: Internet
Author: User
Tags uikit

//

ZyAppDelegate.h

Xx

//

Created by Nimami on 15/7/22.

Copyright (c) 2015 LKL. All rights reserved.

//

#import <UIKit/UIKit.h>

@interface Zyappdelegate:uiresponder <UIApplicationDelegate>

@property (Strong, nonatomic) UIWindow *window;

@end

//

Zyappdelegate.m

Xx

//

Created by Nimami on 15/7/22.

Copyright (c) 2015 LKL. All rights reserved.

//

#import "ZyAppDelegate.h"

#import "FirstViewController.h"

@implementation Zyappdelegate

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

{

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

Override point for customization after application launch.

Self.window.backgroundColor = [Uicolor Whitecolor];

[Self.window makekeyandvisible];

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

Self.window.rootViewController = VC;

return YES;

}

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

{

[Self.window Endediting:yes];

}

-(void) Applicationwillresignactive: (uiapplication *) application

{

Sent when the application are about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as a incoming phone call or SMS message) or when the US Er quits the application and it begins the transition to the background state.

Use the This method to the 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 the This method to release the shared resources, save user data, invalidate timers, and store enough application state info Rmation to the restore your application to the 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's can undo many of the changes made on entering the background.

}

-(void) Applicationdidbecomeactive: (uiapplication *) application

{

Restart any tasks this were paused (or not yet started) while the application is inactive. If the application is previously in the background, optionally refresh the user interface.

}

-(void) Applicationwillterminate: (uiapplication *) application

{

Called when the application are about to terminate. Save data if appropriate. See also Applicationdidenterbackground:.

}

@end

//

FirstViewController.h

Xx

//

Created by Nimami on 15/7/22.

Copyright (c) 2015 LKL. All rights reserved.

//

#import <UIKit/UIKit.h>

@interface Firstviewcontroller:uiviewcontroller

@property NSString * usereceive;

@property NSString * pswreceive;

@property (Weak, nonatomic) Iboutlet Uitextfield *usetf;

@property (Weak, nonatomic) Iboutlet Uitextfield *pswtf;

@end

//

Firstviewcontroller.m

Xx

//

Created by Nimami on 15/7/22.

Copyright (c) 2015 LKL. All rights reserved.

//

#import "FirstViewController.h"

#import "SecondViewController.h"

#import "ZyAppDelegate.h"

@interface Firstviewcontroller ()

@end

@implementation Firstviewcontroller

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

{

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

if (self) {

Custom initialization

}

return self;

}

-(void) viewdidload

{

[Super Viewdidload];

_usetf.text= _usereceive;

_pswtf.text = _pswreceive;

Do any additional setup after loading the view from its nib.

}

Ibaction: keyword that indicates that this method is connected to a control in the Xib

Sender: Parameter name

-(Ibaction) Registerbuttonclick: (UIButton *) sender

{

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

UIApplication * app = [uiapplication sharedapplication];

Zyappdelegate * appdelegate = app.delegate;

AppDelegate.window.rootViewController = VC;

}

-(void) didreceivememorywarning

{

[Super didreceivememorywarning];

Dispose of any resources the can be recreated.

}

@end

//

SecondViewController.h

Xx

//

Created by Nimami on 15/7/22.

Copyright (c) 2015 LKL. All rights reserved.

//

#import <UIKit/UIKit.h>

@interface Secondviewcontroller:uiviewcontroller

@property (Weak, nonatomic) Iboutlet Uitextfield *usetf;

@property (Weak, nonatomic) Iboutlet Uitextfield *pswtf;

@property (Weak, nonatomic) Iboutlet Uitextfield *confirtf;

@end

//

Secondviewcontroller.m

Xx

//

Created by Nimami on 15/7/22.

Copyright (c) 2015 LKL. All rights reserved.

//

#import "SecondViewController.h"

#import "FirstViewController.h"

#import "ZyAppDelegate.h"

@interface Secondviewcontroller ()

@end

@implementation Secondviewcontroller

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

{

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

if (self) {

Custom initialization

}

return self;

}

-(void) viewdidload

{

[Super Viewdidload];

Do any additional setup after loading the view from its nib.

}

-(Ibaction) Backclick: (ID) sender

{

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

UIApplication * app = [uiapplication sharedapplication];

Zyappdelegate * appdelegate = app.delegate;

Appdelegate.window.rootViewController = VC;

}

-(Ibaction) Commitclick: (ID) sender

{

if (_usetf.text.length < 6)

{

Uialertview * Alertview = [[Uialertview alloc]initwithtitle:@ ' warning ' message:@ ' username less than six bits ' Delegate:nil cancelbuttontitle: Nil otherbuttontitles:@ "OK", nil];

[Alertview show];

Return

}

if (_pswtf.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 ([_pswtf.text isequaltostring:_confirtf.text] = = NO)

{

Uialertview * Alertview = [[Uialertview alloc]initwithtitle:@] Warning "message:@" user name inconsistent with password "Delegate:nil Cancelbuttontitle: Nil otherbuttontitles:@ "OK", nil];

[Alertview show];

Return

}

Else

{

Uialertview * Alertview = [[Uialertview alloc]initwithtitle:@] Warning "message:@" Registration is successful, please login! "Delegate:nil cancelbuttontitle: Nil otherbuttontitles:@ "OK", nil];

[Alertview show];

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

UIApplication * app = [uiapplication sharedapplication];

Zyappdelegate * appdelegate = app.delegate;

Vc.usereceive = _usetf.text;

Vc.pswreceive = _pswtf.text;

AppDelegate.window.rootViewController = VC;

}

}

-(void) didreceivememorywarning

{

[Super didreceivememorywarning];

Dispose of any resources the can be recreated.

}

@end

iOS Login Registration interface Jump (interface operation)

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.