How to check if a control is resigning first responder or become first responder?
I have a view that a content some NSTextfields and NSComboboxes. I want to do something when one of these controls resign first responder. I already try the delegate method
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor
if ([control isKindOfClass: [NSTextField class]]){
//custom code
开发者_开发知识库 return YES;
}
}
but it requires that i do something in the previous field.
Try something resignFirstResponder instead of textShouldEndEditing
You can ask the corresponding UIView e.g. with
[view isFirstResponder]
精彩评论