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