iPad开发--QQ空间布局,登录模块
Posted Chaos_G
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 }
- 记住密码和自动登录逻辑
以上是关于iPad开发--QQ空间布局,登录模块的主要内容,如果未能解决你的问题,请参考以下文章
UNITY 接入QQ登录SDK时遇到的坑 2020.9.17