the role of each method in the Uitextfielddelegate protocol
Controls whether the current input box can be edited
-(BOOL) textfieldshouldbeginediting: ( Uitextfield *) TextField
triggered when the input box starts(Get Focus Trigger)
- (void) textfielddidbeginediting: (Uitextfield*) TextField
asks if the input box can end the edit(whether the keyboard can be retracted)
- (BOOL) textfieldshouldendediting: (Uitextfield*) TextField
triggered when the current input box finishes editing ( trigger after keyboard retract )
-(void) textfielddidendediting: ( Uitextfield *) TextField
trigger when input box text changes ( , text change , trigger )
-(BOOL) TextField: ( Uitextfield *) TextField shouldchangecharactersinrange: (nsrange) range replacementstring: ( NSString *) string
Controls whether the input box Clear button is valid(yes,have a; no,No)
- (BOOL) Textfieldshouldclear: (Uitextfield*) TextField
controls whether the keyboard is recycled-(BOOL) Textfieldshouldreturn: (Uitextfield*) TextField
how each method is automatically generated in APPDELEGATE.M in the UI
Triggered when application loading is complete
-(BOOL) application: ( uiapplication *) Application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions
Triggered when an application is about to cancel active state
-(void) applicationwillresignactive: ( uiapplication *) Application
triggered when the current application has entered the background(application hangs in background)
- (void) Applicationdidenterbackground: (uiapplication*) Application
triggered when an application is going to enter the foreground(triggers when the program is about to become active)
- (void) Applicationwillenterforeground: (uiapplication*) Application
the application is already active ( currently running )
-(void) applicationdidbecomeactive: ( uiapplication *) Application
triggers when the application will end
- (void) Applicationwillterminate: (uiapplication*) Application
example of execution order of each method
As an example, the phone is running a program when suddenly the phone
program Flow when there is a telephone entry : applicationwillresignactive:
1. when rejecting
Application State : applicationdidbecomeactive:
2. pick up the phone
Application State: Applicationdidenterbackground:
Common methods for handling screen rotation
when the view controller's View when you re-layout , triggering
-(void) viewwilllayoutsubviews
used to set the current view controller,whether rotation is supported
- (BOOL) Shouldautorotate
set the orientation of the screen rotation , supports three directions , Vertical Direction , Zoo , Right Horizontal screen
-(nsuinteger) supportedinterfaceorientations
The role of each method in the Uitextfielddelegate protocol and the automatic generation of various methods in Xcode APPDELEGATE.M (IOS)