An example of an entry box with only the bottom border of IOS

Source: Internet
Author: User

The input box has a general border (blank input box), full border (rectangular input box), and the border is simple, Only need to set the Uitextfield Layer.bordercolor properties and Layer.borderwidth properties on it, if you want to achieve only with the bottom of the box line of the input box is not too good to get, Baidu a bit found a most stupid is also quite a good way, that is directly below it to add a line on OK. Sample code:


Uitextfield *passwordtextfield = [[Uitextfield alloc] Initwithframe:cgrectmake (60, 120, 140, 23)];
Passwordtextfield.font = Font (15);
Passwordtextfield.placeholder = @ "Please enter password";
[Passwordtextfield Setsecuretextentry:yes];
[Self.view Addsubview:passwordtextfield];

UIView *lineview = [[UIView alloc]initwithframe:cgrectmake (0,passwordtextfield.height-1, passwordTextField.width, 1) ];
Lineview.backgroundcolor = [Uicolor Orangecolor];
[Passwordtextfield Addsubview:lineview];

By the way, please attach an effect chart:

Related Article

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.