Question: What's the correct way to resign the current firstResponder? 

I've seen the following:
Looping through fields and calling resignFirstResponder on each.

```
[[self textFieldForRow:0] resignFirstResponder];
[[self textFieldForRow:1] resignFirstResponder];
[[self textFieldForRow:2] resignFirstResponder];
[[self textFieldForRow:3] resignFirstResponder];

```

And this which looks like it's calling a private function, is this app store safe?:

```
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
UIView   *firstResponder = [keyWindow performSelector:@selector(firstResponder)];   
[firstResponder resignFirstResponder];      

```

Is there a better way? 

Thanks!

Comments:
Looks like the second method is using a private api and someone's app has been rejected because of it: [link](https://stackoverflow.com/questions/1823317/how-do-i-legally-get-the-current-first-responder-on-the-screen-on-an-iphone)

Answer: 
Have a look at this question: [How do I [legally] get the current first responder on the screen on an iPhone?](https://stackoverflow.com/questions/1823317/how-do-i-legally-get-the-current-first-responder-on-the-screen-on-an-iphone)

My answer to that question should work perfectly in your situation.
My suggestion would be to implement a hacky & slow version of firstResponder yourself in a category and then file a radar requesting they add the method. Something along these lines:

```
- (id)my_FirstResponder
    for view in [self subviews]
        if [self isFirstResponder]
            return self
        return [self my_firstResponder]
    return nil

```

Using `performSelector:` to invoke a method not in the public headers is definitely grounds for rejection, so don't do that. Oh, and don't forget to use a prefix (like the above code does) when adding a category to avoid conflicts.