UI入门——简单登陆界面,注册界面及找回密码界面铺设以及切换

AppDelegate.h
<pre name="code" class="objc"><span style="font-size: 18px;">#import <UIKit/UIKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate, UITextFieldDelegate, UIAlertViewDelegate></span>
<span style="font-size: 18px;">@property (retain, nonatomic) UIWindow *window;</span>
<span style="font-size: 18px;">@end</span>
 

 

AppDelegate.m

<span style="font-size:18px;">@interface AppDelegate ()
// 设置属性为了alert
@property (retain, nonatomic) UITextField *greenView2;
@property (retain, nonatomic) UITextField *blueView2;
@property (retain, nonatomic) UIButton *redView1;
@property (retain, nonatomic) UIView *loginContainerView;
@property (retain, nonatomic) UIView *registContainerView;
@property (retain, nonatomic) UIView *passwordContainerView;
@property (retain, nonatomic) UITextField *nameImport;
@property (retain, nonatomic) UITextField *passwordImport;
@property (retain, nonatomic) UITextField *passwordImportAgain;
@end

@implementation AppDelegate
- (void)dealloc
{
    [_window release];
    [super dealloc];
}

// 回收键盘
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}


// 添加alert

// 1.登陆界面
- (void)alertViewShow1
{
    NSLog(@"greenView2  %@    blueView2    %@", self.greenView2.text, self.blueView2.text);
    if ([self.greenView2.text isEqualToString:@"我"] && [self.blueView2.text isEqualToString:@"123"])
    {
        UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:@"提示" message:@"欢迎回来" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertView1 show];
        [alertView1 release];
    }
    else
    {
        UIAlertView *alertView2 = [[UIAlertView alloc] initWithTitle:@"提示" message:@"用户名或者密码错误,请核对后再试" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertView2 show];
        [alertView2 release];
    }
}

// 2.注册界面
- (void)alertViewShow2
{
    if ([self.passwordImport.text isEqualToString:self.passwordImportAgain.text] && self.nameImport.text.length != 0 && self.passwordImport.text.length != 0 && self.passwordImportAgain.text.length != 0)
    {
        UIAlertView *alertView3 = [[UIAlertView alloc] initWithTitle:@"注册成功" message:@"大家庭欢饮您" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertView3 show];
        [alertView3 release];
    }
    else if (self.nameImport.text.length == 0 || self.passwordImport.text.length == 0 || self.passwordImportAgain.text.length == 0)
    {
        UIAlertView *alertView4 = [[UIAlertView alloc] initWithTitle:@"注册失败" message:@"用户名密码或确认密码不能为空" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertView4 show];
        [alertView4 release];
    }
    els
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值