ioS之登录注册界面跳转

//

//  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];

//登录界面

UILabel * useName = [[UILabel alloc]initWithFrame:CGRectMake(30, 100, 80, 30)];

useName.text = @"用户名:";

[self.view addSubview:useName];

UILabel * pswName = [[UILabel alloc]initWithFrame:CGRectMake(30, 150, 80, 30)];

pswName.text = @"密码:";

[self.view addSubview:pswName];

UITextField * useTF = [[UITextField alloc]initWithFrame:CGRectMake(100, 100, 160, 30)];

useTF.borderStyle = UITextBorderStyleRoundedRect;

useTF.placeholder = @"请输入用户名:";

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 = @"请输入密码:";

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:@"登录" forState:UIControlStateNormal];

[self.view addSubview:useButton];

UIButton * pswButton = [UIButton buttonWithType:UIButtonTypeSystem];

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

[pswButton setTitle:@"注册" forState:UIControlStateNormal];

[pswButton addTarget:self action:@selector(registerClick) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:pswButton];

}

-(void)registerClick

{

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

//创建对象

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

//找window

UIApplication * app = [UIApplication sharedApplication];

zyAppDelegate * appDelegate = app.delegate;

//对象作为根控制器

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 = @"用户名:";

[self.view addSubview:useName1];

UILabel * pswName1= [[UILabel alloc]initWithFrame:CGRectMake(30, 150, 80, 30)];

pswName1.text = @"密码:";

[self.view addSubview:pswName1];

UILabel * confirName1= [[UILabel alloc]initWithFrame:CGRectMake(30, 200, 80, 30)];

confirName1.text = @"确认密码:";

[self.view addSubview:confirName1];

_useTF1 = [[UITextField alloc]initWithFrame:CGRectMake(100, 100, 160, 30)];

_useTF1.borderStyle = UITextBorderStyleRoundedRect;

_useTF1.placeholder = @"请输入用户名:";

[self.view addSubview:_useTF1];

_pawTF1 = [[UITextField alloc]initWithFrame:CGRectMake(100, 150, 160, 30)];

_pawTF1.borderStyle = UITextBorderStyleRoundedRect;

_pawTF1.placeholder = @"请输入密码:";

_pawTF1.secureTextEntry = YES;

[self.view addSubview:_pawTF1];

_confirTF1 = [[UITextField alloc]initWithFrame:CGRectMake(100, 200, 160, 30)];

_confirTF1.borderStyle = UITextBorderStyleRoundedRect;

_confirTF1.placeholder = @"确认密码:";

_confirTF1.secureTextEntry = YES;

[self.view addSubview:_confirTF1];

UIButton * useButton1 = [UIButton buttonWithType:UIButtonTypeSystem];

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

[useButton1 setTitle:@"返回" 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:@"提交" 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(@"提交被点击了");

if (_useTF1.text.length < 6)

{

NSLog(@"密码小于六位");

UIAlertView * alertView =[ [UIAlertView alloc]initWithTitle:@"警告" message:@"用户名小于六位" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];

[alertView show];

return;

}

if (_pawTF1.text.length < 6)

{

UIAlertView * alertView =[ [UIAlertView alloc]initWithTitle:@"警告" message:@"密码小于六位" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];

[alertView show];

return;

}

if ([_pawTF1.text isEqualToString:_confirTF1.text] ==NO )

{

UIAlertView * alertView =[ [UIAlertView alloc]initWithTitle:@"警告" message:@"密码和确认密码不一致!" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];

[alertView show];

return;

}

else

{

UIAlertView * alertView =[ [UIAlertView alloc]initWithTitle:@"提示" message:@"注册成功!请登录!" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", 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

时间: 07-21

ioS之登录注册界面跳转的相关文章

ioS之登录注册界面跳转(界面操作)

// //  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) UIWind

HTML登录注册界面怎么制作?

在没有学习CSS样式的前提下,是如何做一个简单的注册界面的. 一.表单标签(form) 首先我们先写一个<form></form>的标签,form标签属于表单标签,通常我们的登录注册界面都是有提交数据的,是和服务器交互用的,用户在提交信息后,给服务器,服务器再根据提交的信息保存,这个时候就需要form标签了. form标签里面常见属性有两种: action:这个是表单提交给某服务器的地址. method:用什么方式提交.通常我们常见的是:get(得到.成为)和post这两种,区别就

Python 实现简单的登录注册界面

Python 实现简单的登录注册界面 注意:编写代码之前需要导入很重要的包 import tkinter as tk import pickle from tkinter import messagebox 主要实现的功能 首先在python字典里定义一对值{'admin':'admin'}如果登录成功显示"How are you! admin". 如果字典里没有一一对应的一对值{'Username':'Password'},则需要注册,紧接着再登录. 实现过程 登录界面 首先初始化一

做一个好看的可翻转登录注册界面

做一个好看的登录注册界面 前言 最近在尝试做网盘,使用的技术栈大概是 .net core + MVC + Mysql + Layui,主要目的是通过这个具体的项目,熟悉熟悉 .net core 开发,.net 的未来就是他了! 我的设想 在完成后端的一部分 建设 之后,我把目光投向了前端--登陆注册,由于这个网盘是用来试手的个人项目,我并不想用曾经用过的制作方式--登录和注册界面分开来做.我试图讲这两个功能合到一个页面上,并且以一种不是很 "Low" 的方式呈现出来. 你也可以认为我只

iOS-Senior11-即时通信2(登录注册界面)

1.引入文件 1.1步骤 1.2步骤 1.3步骤 1.1用storyboard布局 登录界面两个textField,两个button,输入用户名和密码,点击登录,链接服务器成功,并认证成功,点击注册,跳到注册界面,输入用户名,密码,点击注册,链接服务器成功,认证成功,并模态退回登录界面(当注册过的用户名和密码,再次注册时会打印出错误) 2.创建loginViewController //延展方法 @interface LoginViewController () //用户名的输入框 @prope

C#_连接数据库实现 登录注册界面

//编写登录界面逻辑 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClie

百思不得姐第3天:登录注册界面搭建

一:登录注册的界面效果如图 二:界面的搭建 1:登陆界面一般都是moda的模式:新建控制器,勾选xib,则系统会自动关联类,并且自动连线关联view(若是后创建的控制器的xib,则类名相同,关联类,在fileOwer处连线view),而我们自己不用去设置控制器view的frame.或是freeform,只需要更改控制器view的尺寸,例如4.7寸,那么在别的机型上运行正常适配.2:一般背景比较好看的都为背景图片. 3:控制状态栏的样式:1:[UIApplication sharedApplica

家庭记账本app实现登录注册界面以及仿微信操作界面(共4个实现一个)遇到了麻烦

今天学习了数据的创建,以及关于数据库的相关操作. 今天主要是实现了对于数据库的增加和查找. 具体的代码如下: 首先是数据库的创建: DBOpenMessage.java package com.example.thetrueappwen; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; im

Android实战简易教程-第三十二枪(自定义View登录注册界面EditText-实现一键清空)

自定义View实现登录注册页面的EditText一键清空功能,效果如下: 输入框输入文字后自动出现一键清空键,输入框文字为空时,一键清空键隐藏,下面我们看一下如何通过自定义View实现这一效果. 看一下DeletableEditText.java: package com.example.testview; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.