1 //2 //VIEWCONTROLLER.M3 //Uitextfield Detailed4 //5 //Created by Big Huan on 16/1/21.6 //copyright©2016 year BJSXT. All rights reserved.7 //8 9 #import "ViewController.h"Ten One @interfaceViewcontroller () A@property (nonatomic, strong) Uitextfield *TextField; - @end - the @implementationViewcontroller - -- (void) Viewdidload { - [Super Viewdidload]; + -Uitextfield * TextField = [[Uitextfield alloc] Initwithframe:cgrectmake ( -, -, Self.view.frame.size.width- +, -)]; + /* A at Set Border Style - typedef ns_enum (Nsinteger, Uitextborderstyle) { - Uitextborderstylenone,//Nothing (default) - Uitextborderstyleline,//Surround with black lines - Uitextborderstylebezel,//Surround with gray lines, upper, Zoga Shadows - Uitextborderstyleroundedrect//with rounded corners and gray lines around in }; - textfeld.borderstyle = uitextborderstyleroundedrect; to + */ -Textfield.borderstyle =Uitextborderstyleroundedrect; the //Textfield.text = @ "Please enter password"; * //Set Prompt Text $Textfield.placeholder =@"Please enter your password";Panax Notoginseng //set the color of the input text -Textfield.textcolor =[Uicolor Redcolor]; the //start editing whether to clear text + //textfield.clearsonbeginediting = YES; A //textfield.textalignment = nstextalignmentcenter; the //Set Font +Textfield.font = [Uifont systemfontofsize: -]; - //Font Fit Width $ //textfield.adjustsfontsizetofitwidth = YES; $ //Set minimum font size - //textfield.minimumfontsize = 1; - //set the occurrence time of the delete button the //textfield.clearbuttonmode = uitextfieldviewmodewhileediting; - Wuyi //set the left view of the TextField theUIView * small = [[UIView alloc] Initwithframe:cgrectmake (0,0, -, -)]; -Small.backgroundcolor =[Uicolor Graycolor]; Wu -Textfield.leftview =Small; AboutTextfield.leftviewmode =uitextfieldviewmodealways; $ - //Set Security Password - //textfield.securetextentry = YES; - A /* + the Set the keyboard style - typedef ns_enum (Nsinteger, uikeyboardtype) { $ Uikeyboardtypedefault, default keyboard, support for all character uikeyboardtypeasciicapable, ASCII-enabled default keyboard uikeyboardtypenumbersandpunctu ation, standard telephone keypad, supports +*# characters the Uikeyboardtypeurl,url, keyboard, support. com buttons only support URL character Uikeyboardtypenumberpad, numeric keypad the Uikeyboardtypephonepad, telephone keypad the Uikeyboardtypenamephonepad, telephone keypad, also support input person name the uikeyboardtypeemailaddress, keyboard for entering e-mail addresses - Uikeyboardtypedecimalpad Numeric keypad with digital and decimal uikeyboardtypetwitter optimized keypad for easy input @, #字符 in }; the the About */ the theTextfield.keyboardtype =uikeyboardtypeemailaddress; the + /* - the return key becomes what keyBayi typedef ns_enum (Nsinteger, uireturnkeytype) { the Uireturnkeydefault,//Default Gray button, marked with return the Uireturnkeygo,//blue button labeled Go - uireturnkeygoogle,//blue button labeled Google, search by language - uireturnkeyjoin,//blue button labeled Join the Uireturnkeynext,//blue button labeled Next the Uireturnkeyroute,//blue button labeled Route the Uireturnkeysearch,//blue button labeled Search the uireturnkeysend,//blue button labeled Send - Uireturnkeyyahoo,//blue button labeled Yahoo ! the Uireturnkeydone,//blue button labeled done the Uireturnkeyemergencycall,//Emergency call button the };94 the */ the theTextfield.returnkeytype =Uireturnkeygo;98 About /* - 101 Enter letter Case102 typedef ns_enum (Nsinteger, uitextautocapitalizationtype) {103 Uitextautocapitalizationtypenone,//not automatically capitalized (default)104 Uitextautocapitalizationtypewords,//capitalize the first letter of the word the uitextautocapitalizationtypesentences,//capitalize the first letter of the sentence106 uitextautocapitalizationtypeallcharacters,//All letters are capitalized107 };108 textfeld.autocapitalizationtype = Uitextautocapitalizationtypenone;109 the 111 */ theTextfield.autocapitalizationtype =uitextautocapitalizationtypewords;113 theSelf.textfield =TextField; the the [Self.view Addsubview:textfield];117 118 119 } - 121- (void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *)Event {122 123 //Cancel First Response124 //[Self.textfield Resignfirstresponder]; the 126 //End Edit127 [Self.textfield Endediting:yes]; - 129 } the 131 @end
iOS Learning-uitextfield