iOS Note Uikit_uitextfield

Source: Internet
Author: User

-(void) viewdidload

{

[Super Viewdidload];

//Established in which you have complied with the < agreement uitextfielddelegate>

Self.numTF.delegate = self;

Self.passTF.delegate = self;

//Ciphertext display

Self.passTF.secureTextEntry = YES;

}

#pragma Mark-uitextfield Event Monitoring

When the input text box is going to start editing

-(BOOL) textfieldshouldbeginediting: (Uitextfield *) TextField

{

NSLog (@ "Single line input text box will start editing");

return YES;

}

When the input text box starts to enter edit mode

-(void) textfielddidbeginediting: (Uitextfield *) TextField

{

NSLog (@ "Single line input text box starts editing");

}

Called when editing is about to complete

-(BOOL) textfieldshouldendediting: (Uitextfield *) TextField

{

NSLog (@ "Single line input text box will be finished editing");

return YES;

}

When you have exited edit mode

-(void) textfielddidendediting: (Uitextfield *) TextField

{

NSLog (Called when "exiting edit mode");

Print the contents of the current TextField

NSLog (@ "%@", Textfield.text);

Show to Textlabel

Self.textLabel.text = Textfield.text;

}

This method is called when you press the return key on the keyboard

-(BOOL) Textfieldshouldreturn: (Uitextfield *) TextField

{

//Select to change the identity of the first message responder when the line enters the text box.

[SELF.NUMTF Resignfirstresponder];

[Self.passtf Resignfirstresponder];

return YES;

}

#pragma mark-font line wrapping

-(void) viewdidload

{

[Super Viewdidload];

Default Wrap Line

Self.myLabel.numberOfLines = 0;

What's displayed

nsstring *string = @ "ASDFAEATRETGFDSGFDGSDGSDGFSDGSDFGSDFGERWTEWRTYWETYHWERGHGFSHW4TYGWTRFG";

The color of the display

Self.myLabel.backgroundColor = [Uicolor Redcolor];

Show the content

Self.myLabel.text = string;

Calculate Text height (dictionary)

nsdictionary *attribute = @{nsfontattributename:self.mylabel.font};

cgsize size = [string boundingrectwithsize:cgsizemake (0) Options:nsstringdrawingtruncateslastvisib Leline | Nsstringdrawinguseslinefragmentorigin | Nsstringdrawingusesfontleading Attributes:attribute context:nil].size;

CGRect frame = self.myLabel.frame;

Frame.size.height = Size.Height;

Self.myLabel.frame = frame;

}

iOS Note Uikit_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.