Ios_uitextfield Basic Operation

Source: Internet
Author: User

Basic operations
Uitextfield *usernametextfield = [[Uitextfield alloc] init]; Usernametextfield. Frame= CGRectMake ( -, -, -, -); [ Self. WindowAddsubview:usernametextfield]; [Usernametextfield release];//Set styleUsernametextfield. BorderStyle= Uitextborderstyleroundedrect; Usernametextfield. Placeholder= @"Enter Your Name"; Usernametextfield. Text= @"Outlan"; Usernametextfield. Clearbuttonmode= uitextfieldviewmodewhileediting;//Set Right Delete button appears time    UILabel*leftlable = [[UILabelAlloc] Initwithframe:cgrectmake (0,0, -, -)]; Leftlable. Text= @"N";//Set display time for left and right viewUsernametextfield. Leftview= leftlable; Usernametextfield. Leftviewmode= Uitextfieldviewmodealways;    [Leftlable release]; Usernametextfield. Enabled=YES;//Set whether to allow inputUsernametextfield. clearsonbeginediting=NO;//empty at inputUsernametextfield. Securetextentry=NO;//Render dots, commonly used to enter passwordsUsernametextfield. Keyboardappearance= Uikeyboardappearancedark;//Control keyboard color is blackUsernametextfield. Keyboardtype= Uikeyboardtypeemailaddress;//Set keyboard styleUsernametextfield. Returnkeytype= Uireturnkeysearch;//Set the return button style    UIView*keyboard = [[UIViewAlloc] Initwithframe:cgrectmake (0,0,0, -)]; KeyBoard. BackgroundColor= [UicolorGreencolor];//Usernametextfield.inputview = KeyBoard;//Replace keyboard[KeyBoard release];UIView*inputaccessview = [[UIViewAlloc] Initwithframe:cgrectmake (0,0,0, -)]; Inputaccessview. BackgroundColor= [UicolorYellowcolor]; Usernametextfield. Inputaccessoryview= Inputaccessview;//Auxiliary strips[Inputaccessview release];
Retract the keyboard settings proxy object, usually self
// 设置代理    textFiled.delegateself;
Current Class Compliance Protocol
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITextFieldDelegate>
Implementing Protocol Methods
-(bool ) Textfieldshouldreturn: (Uitextfield *) textfield{nslog  (@     "click return" ); [TextField Resignfirstresponder];    //give up first responder retract keyboard  return  yes ;} -(bool ) textfieldshouldbeginediting: (Uitextfield *) textfield{nslog  (@); return  yes ;} -(bool ) textfieldshouldendediting: (Uitextfield *) textfield{nslog  (@); return  yes ;} 

Ios_uitextfield Basic Operations

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.