但是,考虑到基于视图的灵活性NStableVIEws提供,这种行为并不总是令人满意,因为现在有许多不同的复杂应用程序可能而不仅仅是做一个“旧学校”表.
如何通过一次单击轻松地在基于视图的NStableVIEw中对第一响应者进行控制(可能与其他控件一起在单元格中)?
解决方法 要解决此问题,请在NStableVIEw上覆盖此方法:@interface NSResponder (NSControlEditingSupport)/* This is a responder chain method to allow controls to determine when they should become first responder or not. Some controls,such as NSTextFIEld,should only become first responder when the enclosing NStableVIEw/NSbrowser indicates that the vIEw can begin editing. It is up to the particular control that wants to be valIDated to call this method in its -mouseDown: (or other time) to determine if it should attempt to become the first responder or not. The default implementation returns YES when there is no -nextResponder,otherwise,it is forwarded up the responder chain. NStableVIEw/NSbrowser implements this to only allow first responder status if the responder is a vIEw in a selected row. It also delays the first responder assignment if a doubleAction needs to (possibly) be sent. 'event' may be nil if there is no applicable event.*/- (BOol)valIDateProposedFirstResponder:(NSResponder *)responder forEvent:(NSEvent *)event NS_AVAILABLE_MAC(10_7);@end
并立即返回YES以允许快速制作第一个响应者.如果文本字段被命中,该表“延迟”制作第一响应者,并且除非首先选择该行,否则不允许它进行.
总结以上是内存溢出为你收集整理的objective-c – 在基于视图的NSTableView中,如何通过单击使控件成为第一个响应者?全部内容,希望文章能够帮你解决objective-c – 在基于视图的NSTableView中,如何通过单击使控件成为第一个响应者?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)