[IOS] Uitextfield properties that are often overlooked

Source: Internet
Author: User

These days I looked atIOS 7 UI Transition Guide and found an input box made with system Uitextfield,

I don't know if you notice the UI of the high-D map navigation in the system ... Then it's the beginning of the story ~ t_t ~

Uitextfield text in the input box is composed of two parts, the left is the default hint text, the right is

The part of the user input, and the response part of Uitextfield is after the ":", the first reaction is to use the picture

Do the background map, and then the right of the text part of the blanks, or to mediate the input of the text display location, as everyone knows

There is a leftview in the property, there is also Rightview, and you can specify its display mode--leftviewmode

Put a code on it:

    UILabel *leftlabel = [[UILabel alloc] Initwithframe:cgrectmake (0, 0, $)];    Leftlabel.backgroundcolor = [Uicolor clearcolor];    Leftlabel.textcolor = [Uicolor lightgraycolor];    Leftlabel.text = @ "Start:";        Uitextfield *xtextfield = [[Uitextfield alloc] Initwithframe:cgrectmake ([[]];    Xtextfield.borderstyle = Uitextborderstyleroundedrect;    Xtextfield.contentverticalalignment = Uicontrolcontentverticalalignmentcenter;    Xtextfield.leftview = LBL;    Xtextfield.leftviewmode = uitextfieldviewmodealways;    Xtextfield.adjustsfontsizetofitwidth = YES;


Another powerful attribute of Uitextfield is that Adjustsfontsizetofitwidth is based on the content

Size automatic resizing, really hanging days ~ ~

Then you will see a nsattributedstring *attributedtext this attribute, often seen, and no details

Know its usage, in the picture and text mix and so often see to use similar settings font, font color, shadow, etc., good strong appearance

The code that was stolen in the text Kit tutorial



And then what's the key to this type of dictionary processing property?

Find some common key for everyone to refer to

NSString *Const*const*const*Const Uitextattributetextshadowoffset, sets the translation amount of the Titlewz shadow;
How can this be enough, and then according to the Nsforegroundcolorattributename attribute in the stolen code, finally

Find the source, hahaha, ~~~~~ basic in the NSAttributedString.h header file declared, should have found Ah,






[IOS] Uitextfield properties that are often overlooked

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.