黑马程序员技术交流社区

标题: 仿QQ登入界面(高仿版) [打印本页]

作者: 叶子哥    时间: 2016-6-12 12:30
标题: 仿QQ登入界面(高仿版)

     先看效果:



主要代码如下:
  1. @implementation ViewController

  2. - (IBAction)loadingBtn:(UIButton *)sender {
  3.    
  4.     [self.view endEditing:YES];
  5.     NSString *QQNumber = self.qqNumber.text;
  6.     NSString *QQPwd = self.pwd.text;
  7.     NSLog(@"用户QQ号码是:%@, 密码:%@",QQNumber,QQPwd);
  8.    
  9.     if ([QQNumber isEqualToString:@"123456"] && [QQPwd isEqualToString:@"qwert"]) {
  10.         sender.hidden = YES;
  11.         self.act.hidden = NO;
  12.         self.showLoadLabel.hidden = NO;
  13.         [self.act startAnimating];
  14.         
  15.         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  16.             [self showLoadedSuccess];
  17.             
  18.         });

  19.     }else{
  20.    
  21.         //创建弹框
  22.         UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"密码或账号不正确" preferredStyle:UIAlertControllerStyleAlert];
  23.         self.alert = alert;
  24.         //给弹框添加按钮
  25.         UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  26.             NSLog(@"点击了");
  27.         }];
  28.         [alert addAction:alertAction];
  29.         
  30.         //显示弹框
  31.         [self presentViewController:alert animated:YES completion:^{
  32.             NSLog(@"点击了");
  33.         }];

  34.     }
  35.    
  36.    
  37. }

  38. - (void)showLoadedSuccess{

  39.     [self.act stopAnimating];
  40.     [self.showLoadLabel setText:@"登入成功"];
  41.     self.act.hidden = YES;
  42. }

  43. - (void)viewDidLoad {
  44.     [super viewDidLoad];
  45.     // Do any additional setup after loading the view, typically from a nib.
  46.    
  47.     self.act.hidden = YES;
  48.     self.showLoadLabel.hidden = YES;
  49. }
复制代码



作者: dayuanzhang    时间: 2016-6-12 17:49
楼主棒棒哒
作者: 王大懂    时间: 2016-12-6 21:08
楼主,为什么没有下拉菜单选择用户呢
作者: zhao543    时间: 2017-5-2 21:30
东西是好东西,希望再接再厉




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2