zoukankan      html  css  js  c++  java
  • iPad开发--QQ空间布局,登录模块

    一.登录模块

    • 登录逻辑
       1 - (IBAction)loginClick:(UIButton *)sender {
       2     
       3     self.view.userInteractionEnabled = NO;
       4     
       5     [self.view endEditing:YES];
       6     
       7     [self.activeView startAnimating];
       8     
       9     if (self.accountField.text.length == 0 || self.pwdField.text.length == 0) {
      10         
      11         [self showError:@"帐号和密码不能为空"];
      12     }
      13     if ([self.accountField.text isEqualToString:@"123"] && [self.pwdField.text isEqualToString:@"123"]) {
      14         
      15         // 帐号密码正确 跳转控制器
      16         ChaosMainViewController *mainVC = [[ChaosMainViewController alloc] init];
      17         mainVC.view.backgroundColor = [UIColor colorWithRed:55 / 255.0 green:55 / 255.0 blue:55 / 255.0 alpha:1.0];
      18         [self presentViewController:mainVC animated:YES completion:nil];
      19         
      20     } else {
      21         
      22         [self showError:@"帐号或密码错误"];
      23     }
      24     
      25 }
    • 登录不成功后的动画效果
       1 - (void)showError:(NSString *)error
       2 {
       3     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
       4         
       5         UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"登录错误" message:error preferredStyle:UIAlertControllerStyleAlert];
       6         [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
       7             
       8         }]];
       9         
      10         [self presentViewController:alert animated:YES completion:nil];
      11         
      12         CAKeyframeAnimation *shakeAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.x"];
      13         shakeAnim.values = @[@-10,@0,@10,@0];
      14         shakeAnim.repeatCount = 9;
      15         shakeAnim.repeatDuration = 0.3;
      16         // 动画
      17         [self.animView.layer addAnimation:shakeAnim forKey:nil];
      18         
      19         [self.activeView stopAnimating];
      20         
      21         self.view.userInteractionEnabled = YES;
      22     });
      23     
      24 }
    • 记住密码和自动登录逻辑                                                                                                  
  • 相关阅读:
    负载均衡获得真实源IP的6种方法
    美图全链路监控实战
    移动端APM网络监控与优化方案
    k8s 如何对外提供服务
    mysql5.7安装audit审计插件
    mysql 5.7安装密码校验插件validate_password
    Linux Crontab 定时任务
    stm32 hard fault usage fault UNALIGNED -> task stack overflow
    linux逻辑卷管理(LVM)
    suse11开启telnet服务
  • 原文地址:https://www.cnblogs.com/gchlcc/p/5562963.html
Copyright © 2011-2022 走看看