iPhone中textfieldshouldendediting和textfieldDidendediting之间的差异 [英] Diffrence between textfieldshouldendediting and textfieldDidendediting in iPhone
问题描述
可能重复:
iPhone中textfieldshouldendediting和textfieldDidendediting之间的差异
textFieldShouldendEditing
和 textfieldDidEndEditing
方法之间的差异是什么?何时使用这些方法。
What is the diffrence between textFieldShouldendEditing
and textfieldDidEndEditing
methods? and when will use these methods.
推荐答案
来自文档:
textFieldShouldendEditing:
此方法是在要求文本字段重新签名第一响应者状态时调用。当您的应用程序要求文本字段重新对焦或用户尝试将编辑焦点更改为其他控件时,可能会发生这种情况。但是,在焦点实际更改之前,文本字段会调用此方法,以便让您的代理人有机会决定是否应该这样做。
This method is called when the text field is asked to resign the first responder status. This might occur when your application asks the text field to resign focus or when the user tries to change the editing focus to another control. Before the focus actually changes, however, the text field calls this method to give your delegate a chance to decide whether it should.
textfieldDidEndEditing:
在文本字段重新启动其第一个响应者状态后调用此方法。您可以使用此方法更新委托的状态信息。例如,您可以使用此方法隐藏仅在编辑时可见的叠加视图。
This method is called after the text field resigns its first responder status. You can use this method to update your delegate’s state information. For example, you might use this method to hide overlay views that should be visible only while editing.
因此, textFieldShouldendEditing:
方法将在<$ c $之前调用c> textfieldDidEndEditing:方法
这篇关于iPhone中textfieldshouldendediting和textfieldDidendediting之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!