IOS Uitextfielddelegate Protocol

Source: Internet
Author: User

Many people think that Uitextfield is very simple, why do you write this agreement?

may be used in development;

Like what:

The color of the underline below the text box changes depending on the state of the input;

So, be familiar with the Uitextfielddelegate protocol

First, let's take a look at the official note:

-(BOOL) textfieldshouldbeginediting: (Uitextfield *) TextField;//return NO to disallow editing.- (void) Textfielddidbeginediting: (Uitextfield *) TextField;//became first responder-(BOOL) textfieldshouldendediting: (Uitextfield *) TextField;//return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end- (void) Textfielddidendediting: (Uitextfield *) TextField;//May is called if forced even if shouldendediting returns NO (e.g. view removed from window) or Endediting:yes called< /c3>-(BOOL) TextField: (Uitextfield *) TextField Shouldchangecharactersinrange: (nsrange) range replacementstring: ( NSString *)string;//return NO to the change text-(BOOL) Textfieldshouldclear: (Uitextfield *) TextField;//called when Clear button pressed. Return No. to ignore (no notifications)-(BOOL) Textfieldshouldreturn: (Uitextfield *) TextField;//called when ' return ' key pressed. Return No. to ignore.

1.

-(void) textfielddidbeginediting: (Uitextfield *) TextField;

Text box has started editing

2.

-(void

text box has finished editing

3. Whether other settings allow input control

1,-(BOOL) textfieldshouldbeginediting: (Uitextfield *) TextField;//return NO to disallow editing.
Controls whether input is allowed

2,-(BOOL) textfieldshouldendediting: (Uitextfield *) TextField;//return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to endWhether to end input 3,-(BOOL) TextField: (Uitextfield *) TextField Shouldchangecharactersinrange: (nsrange) Range Replacementstring: (NSString *)string;//return NO to the change text
Whether to change the input text
4,-(BOOL) Textfieldshouldclear: (Uitextfield *) TextField;//Called when Clear button pressed. Return No to ignore (no notifications)
When the empty button is called, return is no, ignore empty
5,-(BOOL) Textfieldshouldreturn: (Uitextfield *) TextField;//called when ' return ' key pressed. Return No. to ignore.
   Call when the return button is clicked, return no, do not respond

IOS Uitextfielddelegate Protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.