Class / Superclass / Specific class matching condition, can it be simpler? I recently built a way to automagically dismiss firstResponders for an app I'm building. Is there a more efficient way to approach this?

- (void)resignFieldStackRespondersExcept:(id)fieldException
{
    for (id field in self.fieldStack) {
        if ([field isKindOfClass:[fieldException class]] ||
            ([[field class] isSubclassOfClass:[fieldException class]] || [[fieldException class] isSubclassOfClass:[field class]]) ||
            (([[field class] isSubclassOfClass:[UITextField class]] &amp;&amp; [[fieldException class] isSubclassOfClass:[UITextView class]]) ||
             ([[field class] isSubclassOfClass:[UITextView class]] &amp;&amp; [[fieldException class] isSubclassOfClass:[UITextField class]]))) {
            continue;
        }

        [self resignField:field];
    }
}

- (void)resignField:(id)field
{
    if ([field isKindOfClass:[AccessoryPicker class]]) {
        [field closePicker:YES];
    }

    if ([field isKindOfClass:[TagsTextView class]]) {
        [field saveTrailingTag];
    }

    if ([field isKindOfClass:[UITextField class]] || [field isKindOfClass:[UITextView class]]) {
        [field resignFirstResponder];
    }
}
There's not really enough information or context here to make any sort of comment on the efficiency of this pair of methods, but it seems like this could simply be narrowed down into a single method.

We're iterating through a collection so we can call resignField: on specific classes only, and all of the logic in resignField: already works on specific classes only.  The only thing that's left is the check for whatever this exception is:

- (void)resignFieldStackRespondersExcept:(id)fieldException {
    for (id field in self.fieldStack) {
        if ([field isKindOfClass:[AccessoryPicker class]]) {
            [field closePicker:YES];
        } else if ([field isKindOfClass:[TagsTextView class]]) {
            [field saveTrailingTag];
        } else if ([field isKindOfClass:[UITextField class]] 
                   &amp;&amp; ![[fieldException class] isSubclassOfClass:[UITextView class]]) {
            [field resignFirstResponder];
        } else if ([field isKindOfClass:[UITextView class]] 
                   &amp;&amp; ![[fieldException class] isSubclassOfClass:[UITextField class]]) {
            [field resignFirstResponder];
        }
    }
}


Now we can eliminate the second method entirely.  The first method is more readable and unnecessary checks have been removed.