Properties, proxies, and notifications for IOS Uitextfield

Source: Internet
Author: User

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

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.