开发者

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]

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜