One,uitextfield notice (uitextfield text changes will call notification)
Initializes a (wired) Uitextfield control
@property (Weak, nonatomic) Iboutlet Uitextfield *pwdfield;
initializing notifications in Viewdidload
Note the set value of name and object
object: Self.pwdfield];
Implementing Notification methods
/* * * */-(void) textchange{ //In this case the notification method is dropped when the self.pwdfiled control text changes.
}
Second,the agent method of Uitextfield
-(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< /c0>-(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.
Iii.attributes of Uitextfield
Create Uitextfield Object Uitextfield * Ym=[[uitextfield Alloc]init];
Set text
[email protected] "to sleep";//Set Uitextfield text color Ym.textcolor=[uicolor redcolor];// Sets the Uitextfield text box background color Ym.backgroundcolor=[uicolor graycolor];//sets the style of the Uitextfield border ym.borderstyle= uitextborderstyleroundedrect;//set Uitextfield proxy ym.delegate=self;//settings Uitextfield text alignment ym.textalignment= uitextalignmentcenter;//Center-aligned ym.textalignment=uitextalignmentleft;//left-justified ym.textalignment=uitextalignmentright;// Right align ym.textalignment=uitextalignmentfill;//fill align//set Uitextfield text size and font Ym.font=[uifont fontwithname:@ "Times New Roman "size:20];//Settings Uitextfield Adaptive text box size ym.adjustsfontsizetofitwidth=yes/no;//Adaptive width ym.adjustsfontsizetofitheight =yes/no;//Adaptive Height//Set Uitextfield if you have one-click Clear function ym.clearsonbeginediting=yes/no;//Set a button to clear whether the buttons appear ym.clearbuttonmode= uitextfieldviewmodenever;//set Uitextfield initial hidden text [email protected] "Enter password";// When the Uitextfield style is uitextborderstylenone, modify the background image ym.background=[uiimage imagenamed:@ "Xx.png"];// Set the left side of the Uitextfield viewym.leftview=xxx;//settings Uitextfield The left view mode ym.leftviewmode=uitextfieldviewmodealways;// Set UiteOn the right side of the Xtfield viewym.rightview=xxx;//set the Uitextfield right view pattern ym.rightviewmode=uitextfieldviewmodealways;// Set the Uitextfield of the word ym.contentverticalalignment=uicontrolcontentverticalalignmentcenter;
Properties, proxies, and notifications for IOS Uitextfield