当离线时,uitextfield在iPhone上运行textFieldShouldBeginEditing两次

时间:2010-08-26 20:58:09

标签: uitextfield

我无法弄清楚为什么我的应用程序运行UITextField委托方法textfieldshouldbeginEditing两次当我处于飞行模式和想法时。

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField 
{
    NSLog(@"TFSBE profile Table = %i", textField.tag);
    if ([[[UIApplication sharedApplication] delegate] checkInternet]) 
    {
        return YES;
    }
    else 
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Online" message:@"You Cannot change your User Name while not online" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [alert show];
        [alert release];
        return NO;
    }
}

- (void)textFieldDidEndEditing:(UITextField *)textField 
{
    //[textField resignFirstResponder];
    NSString *text = [textField text];

    switch ([textField tag]) ....... do stuff
    [self.tableView reloadData];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField 
{ 
    //[textField resignFirstResponder];
    return YES;
}

0 个答案:

没有答案