Uitextfield Learning Knowledge points

Source: Internet
Author: User

Uitwxtfield (input box): A control that is available in iOS to display text and edit text.

Core Features: Text editing

1. Create an input Box object

Uitextfield *TF = [[Uitextfield alloc] Initwithframe:cgrectmake (30, 100, 300, 40)];

2. Configuring related properties

Tf.backgroundcolor = [Uicolor Yellowcolor];

2.1 Setting prompt text (VIP)

Tf.placeholder = @ "Please enter your measurements";

2.2 Setting input Box contents (VIP)

Tf.text = @ "38";

2.3 Setting the text color

Tf.textcolor = [Uicolor Redcolor];

2.4 Set Text alignment-center alignment

Tf.textalignment = Nstextalignmentcenter;

2.5 Setting the font size

Tf.font = [Uifont boldsystemfontofsize:25];

2.6 Clears the contents of the input box when the input box is selected for the first time.

tf.clearsonbeginediting = YES;

2.7 Set Clear button mode

Tf.clearbuttonmode = uitextfieldviewmodewhileediting;

2.8 Setting the Input box style

Tf.borderstyle = Uitextborderstyleroundedrect;

2.9 Setting the input box can edit--Turn off user interaction (NO)

tf.userinteractionenabled = YES;

2.10 Setting the keyboard type--numeric keypad

Tf.keyboardtype = Uikeyboardtypenumberpad;

2.11 Setting the keyboard appearance style

Tf.keyboardappearance = Uikeyboardappearancedark;

2.12 Setting the input box contents to display in Safe mode

Tf.securetextentry = YES;

2.13 Agent (detects various behavior of input box) (VIP)

Tf.delegate = self;//Proxy specified as Appdelegate object

3. Add to Parent View

[Self.window ADDSUBVIEW:TF];

4. Release of ownership

[TF release];

Uitextfield Learning Knowledge points

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.