zoukankan      html  css  js  c++  java
  • 简单的注册 登录

    //注册页面的Button事件

    - (IBAction)action:(id)sender {

        

        if ([self.username.text isEqualToString:@""]||[self.password.text isEqualToString:@""]||[self.Apassword.text isEqualToString:@""])

        {

            

            

            UIAlertView *av=[[UIAlertView alloc] initWithTitle:@"提示" message:@"输入不能为空" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];

            [av show];

        }

        else

        {

            if (![self.password.text isEqualToString:self.Apassword.text]) {

                UIAlertView *av=[[UIAlertView alloc] initWithTitle:@"提示" message:@"输入密码不一致" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];

                [av show];

            }else

            {

                //NSUserDefaults 存一些短小数据

                //在注册里将账号密码存入进去,去登录里取出数据

                NSUserDefaults *user=[NSUserDefaults standardUserDefaults];

                [user setObject:self.username.text forKey:@"userName"];

                [user setObject:self.Apassword.text forKey:@"passWord"];

                [user synchronize];

                [self dismissViewControllerAnimated:YES completion:nil];

                

            }

        

        }

        

    }

     

     

    ****************************

     

    //登录

    - (IBAction)landing:(id)sender {

        //NSUserDefaults 存放在Library文件perferences

        NSUserDefaults *user=[NSUserDefaults standardUserDefaults];

        

        if ([[user objectForKey:@"userName"]isEqualToString:self.userName.text]&&[[user objectForKey:@"passWord"]isEqualToString:self.passWord.text]) {

        

            UIAlertView *av=[[UIAlertView alloc] initWithTitle:@"提示" message:@"登陆成功" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];

            [av show];

        }

        else

        {

            UIAlertView *av=[[UIAlertView alloc] initWithTitle:@"提示" message:@"登陆失败" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];

            [av show];

            

        }

        

    }

  • 相关阅读:
    数值项目的格式化
    ORACLE ERROR CODE代表的意思
    深入了解 Microsoft AJAX Library
    调用MSScriptContro来运算字符串表达式
    C# 调用带参数EXE文件及带启动参数EXE制作
    将DataTable或Ilist<>转换成JSON格式
    客户端控件调用服务器的参数
    调用ICodeCompiler来计算字符串表达式
    录像工具
    今天是开博客园的第一天
  • 原文地址:https://www.cnblogs.com/haiying/p/4117594.html
Copyright © 2011-2022 走看看