开发者

Detecting GO key on keyboard, and popping to top of nav stack

I am trying to implement signup/login via a nav controller for my iphone app.

My issue is I need to detect the GO button and pop to the nav root. Here is my code:

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    NSLog(@"RETURN KEY HIT!");
    [textField resignFirstResponder];
    NSLog(@"email = %@", emailTextField.text);
    NSLog(@"pw = %@", passwordTextField.text);
    [navController popToRootViewControllerAnimated:TRUE];
    return YES;
}

GO does cause this method to be called, but the nav controller doesn't pop. I'm not surpr开发者_Go百科ised as the method returns a BOOL so it's obviously not designed for this use.

So what is the correct way to handle detecting a GO and acting on it?

Thanks!

alt text http://grab.by/2SnU


Did you try [self.navigationController popToRootViewControllerAnimated:TRUE];


simple. as Yannick L suggested I had a null for my nav. Duh :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜