UITextField resignFirstResponder not working?

Posted by Tejaswi Yerukalapudi on Stack Overflow See other posts from Stack Overflow or by Tejaswi Yerukalapudi
Published on 2010-04-19T02:44:57Z Indexed on 2010/04/19 2:53 UTC
Read the original article Hit count: 1039

Filed under:
|

I've double checked all the connections in the nib file. My code -

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void)viewDidLoad {
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"iphone_bg_login.png"]];
self.title = @"Login screen";
loginTxt = [[UITextField alloc] init];
pwdText = [[UITextField alloc] init];
loginFailedTxt = [[UILabel alloc] init];
loginBtn = [[UIButton alloc] init];
navAppDelegate = (NavAppDelegate *)[[UIApplication sharedApplication] delegate];
navAppDelegate.navController.navigationBarHidden = YES;
//NSArray *subVs = (NSArray *) [self.view subviews];
[super viewDidLoad];
}

I've used a subclass of UIView (UIControl) and added all the UI elements to it in the Interface builder.The UIControl's touchDown method is connected to backgroundTap method.

-(IBAction) backgroundTap:(id) sender {
[loginTxt resignFirstResponder];
[pwdText resignFirstResponder];
//[[UIApplication sharedApplication] becomeFirstResponder];
//[sender resignFirstResponder];
}

So the keyboard isn't removed like it's supposed to. Not sure why.

Thanks for the help! Teja.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitextfield