开发者

How to check if a control is resigning first responder or become first responder?

开发者 https://www.devze.com 2023-03-09 09:01 出处:网络
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

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

精彩评论

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