IOS Uitextfield Usage Introduction

Source: Internet
Author: User

Commissioned

1. Going to start editing

-(BOOL) textfieldshouldbeginediting: (Uitextfield *) TextField

{

return YES;

}

2.

-(void) textfielddidbeginediting: (Uitextfield *) textfield{    //triggered when editing starts, text field will become first responder}3.-(BOOL) textfieldshouldendediting: (Uitextfield *) textfield{    //returns a BOOL value, Specifies whether the text field is allowed to end editing, and when the edit is finished, the text field yields first responder    //to prevent the text field from disappearing when the user finishes editing, you can return no     //This is useful for programs where text fields must always remain active, such as instant messaging     return NO;  4.-(BOOL) TextField: (uitextfield*) TextField Shouldchangecharactersinrange: (nsrange) Range replacementstring :(NSString *) string{    //This method is called when the user uses the AutoCorrect feature to modify the input text to the recommended text.     //This is especially useful for applications that want to join the Undo option     //can track the last modification made in a field, or log records of all edits for auditing purposes.       //to prevent text from being changed you can return no    //this method has a Nsrange object that indicates the position of the changed text , it is suggested that the modified text is also in which     return YES;} 5.-(BOOL) Textfieldshouldclear: (Uitextfield *) textfield{    //returns a BOOL value indicating whether to allow content to be purged based on user request     //can be set in a specificAllow the content to be cleared     return YES;} 6.-(BOOL) Textfieldshouldreturn: (Uitextfield *) textfield{    //returns a BOOL value indicating whether the edit is allowed to end when the ENTER key is pressed     //If you allow the Resignfirstresponder method to be called, this causes the end of the edit, and the keyboard is closed     [textfield resignfirstresponder];//check resign The meaning of this word to understand this method     return YES;}   To set up a proxy:mytextfield.delegate=self;

IOS Uitextfield Usage Introduction

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.