代码之家  ›  专栏  ›  技术社区  ›  Rahul Vyas

Textfield很晚才辞职?

  •  1
  • Rahul Vyas  · 技术社区  · 16 年前

    -(IBAction)SignINClicked
    {
        [Email resignFirstResponder]; //TextField
    [Password resignFirstResponder];//TextField
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.10]; 
    [[self view] setFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
    [UIView commitAnimations];  
    sleep(0.10);
    if([Email.text isEqualToString:@""] || [Password.text isEqualToString:@""])
    {
        if([Email.text isEqualToString:@""] && [Password.text isEqualToString:@""])
        {
            UIAlertView *Error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please fill email and password" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [Error show];
            [Error release];
        }       
        else if([Email.text isEqualToString:@""])
        {
            UIAlertView *Error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please fill email" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [Error show];
            [Error release];
        }
        else if([Password.text isEqualToString:@""])
        {
                UIAlertView *Error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please fill password" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                [Error show];
                [Error release];
        }
    }
    else
    {
        [AppDelegate startLoading];     
        BOOL isCorrectUser=[self logIn:Email.text Password:Password.text];
        if (isCorrectUser==TRUE)
        {
            if(checkboxSelected==1)
                [self rememberMe:YES];
            else
                [self rememberMe:NO];
            [self performSelector:@selector(ShowDashboard) withObject:nil afterDelay:5];
        }   
        else
        {
            [AppDelegate endLoading];
            UIAlertView *Error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Either user name/password is incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [Error show];
            [Error release];
        }
    }
    

    -(void)startLoading
    {
    [UIApplication sharedApplication].networkActivityIndicatorVisible=YES;
    if(MyWaitViewObj==nil)
    {
        MyWaitViewObj = [[MyWaitViewController alloc] initWithNibName:@"MyWaitView" bundle:nil];
    }   
    [NSThread detachNewThreadSelector:@selector(showMyWaitView) toTarget:self withObject:nil];
    [NSThread sleepForTimeInterval:0.1];
    }
    
    -(void)endLoading
    {
    [MyWaitViewObj.view  removeFromSuperview];
    [UIApplication sharedApplication].networkActivityIndicatorVisible=NO;
    }
    

    现在,当我单击signin按钮时,[appdelegate startloading]方法首先执行,然后键盘隐藏。实际上,它应该先隐藏键盘,然后开始加载

    1 回复  |  直到 16 年前
        1
  •  2
  •   willc2    16 年前

    [self performSelector:@selector(someMethod:) withObject:nil afterDelay:someTimeDelay];