码迷,mamicode.com
首页 > 其他好文 > 详细

UITextfield代理方法传递

时间:2014-08-06 22:10:23      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:style   io   for   art   ar   div   line   amp   

The sequence of messages that both text views and text fields send to their delegates is as follows:
      1. Just before a text object becomes first responder—textFieldShouldBeginEditing: (text field) and

textViewShouldBeginEditing: (text view).The delegate can verify whether the text object should become first responder by returning YES (the default) or NO.

  1. Just after a text object becomes first responder—textFieldDidBeginEditing: (text field) and textViewDidBeginEditing: (text view).

    The delegate can respond to this message by updating state information or, for example, by showing an overlay view during the editing session.

  2. During the editing session—various.

    While the user enters and edits text, the text object invokes certain delegation methods (if implemented). For example, the delegate of a text view can receive a textViewDidChange: message when any text changes. The delegate of a text field can receive a textFieldShouldClear: message when the user taps the clear button of a text field; the delegate returns a Boolean value indicating whether the text should be cleared.

  3. Just before a text object resigns first responder—textFieldShouldEndEditing: (text field) and textViewShouldEndEditing: (text view).

    The primary reason for a delegate to implement these methods is to validate entered text. For example, if text should conform to a given format, the delegate validates the entered string here and returns NO if the string does not conform. The default return value is YES.

    A related method for text fields is textFieldShouldReturn:. When the user taps the return key, the text field class sends a textFieldShouldReturn: message to the delegate to ask whether it should resign first responder.

  4. Just after text a object resigns first responder—textFieldDidEndEditing: (text field) and textViewDidEndEditing: (text view). 

UITextfield代理方法传递,布布扣,bubuko.com

UITextfield代理方法传递

标签:style   io   for   art   ar   div   line   amp   

原文地址:http://www.cnblogs.com/vimbin/p/3895548.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!