<span id="Label3"></p><p>Uitextfield->uicontrol->uiview<br>Common Properties<br>1. Convert picture objects to color objects<br>Textfield.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@ "DOVE 1"]];<br>2.borderStyle border Style<br>Textfield.borderstyle = uitextborderstylenone;<br>3.contentVerticalAlignment Text Vertical Direction<br>Textfield.contentverticalalignment = uicontrolcontentverticalalignmentcenter;<br>4.adjustsFontSizeToFitWidth Adaptive Text Size<br>Textfield.adjustsfontsizetofitwidth = YES;<br>5.minimumFontSize Minimum Font<br>Textfield.minimumfontsize = 18;<br>6.keyboardAppearance Keyboard appearance<br>Textfield.keyboardappearance = uikeyboardappearancedark;<br>7.keyboardType keyboard Style<br>Textfield.keyboardtype = uikeyboardtypedefault;<br>8.textColor text color<br>Textfield.textcolor = [uicolor purplecolor];<br>9.returnKeyType return key Style<br>Textfield.returnkeytype = uireturnkeygo;<br>10.autocapitalizationType Letter Capitalization Style<br>Textfield.autocapitalizationtype =uitextautocapitalizationtypeallcharacters;<br>11.autocorrectionType Automatic error correction<br>Textfield.autocorrectiontype = NO;<br>12.placeholder hint Text<br>Textfield.placeholder = @ "dragon slayer blades, click on send";<br>13.secureTextEntry whether the ciphertext display<br>Textfield.securetextentry = YES;<br>14.clearButtonMode One-click Delete Mode<br>Textfield.clearbuttonmode = uitextfieldviewmodewhileediting;<br>15.clearsOnBeginEditing re-editing is cleared<br>textfield.clearsonbeginediting = YES;<br>16.leftView left View<br>Textfield.leftview = view;<br>17.leftViewMode Left view mode<br>Textfield.leftviewmode = uitextfieldviewmodealways;<br>18.rightView Right View<br>19.rightViewMode Right view mode<br>The view above the 20.inputAccessoryView keyboard<br>21.inputView keyboard Style<br>Agent for 22.textfield<br>/**<br>* Whether the input box can start entering text<br>*<br>* @param TextField<br>*<br>* @return no means no input, yes indicates you can enter<br>*/<br>-(BOOL) textfieldshouldbeginediting: (uitextfield *) textfield{<br>NSLog (@ "%s",<strong><strong>func</strong></strong>);<br>Return YES;</p><p>}//return NO to disallow Editing.<br>/**<br>* The input box starts responding and executes<br>*<br>* @param TextField<br>*/<br>-(void) textfielddidbeginediting: (uitextfield *) textfield{<br>NSLog (@ "%s",<strong><strong>func</strong></strong>);<br>}//became First Responder<br>Whether the input box can end the input text<br>-(BOOL) textfieldshouldendediting: (uitextfield *) textfield{<br>If (textField.text.length!=2) {<br>Return NO;<br>// }<br>NSLog (@ "%s",<strong><strong>func</strong></strong>);<br>Return YES;<br>}//return YES to allow editing to stop and to resign first responder Status. NO to disallow the editing session to end<br>/**<br>* Input box end response is executed<br>*<br>* @param TextField<br>*/<br>-(void) textfielddidendediting: (uitextfield *) textfield{<br>NSLog (@ "%s",<strong><strong>func</strong></strong>);<br>}//may is called if forced even if shouldendediting returns NO (E.G. view removed from Window) or endediting:yes called<br>//<br>/**<br>* The method to execute if the text of the input box changes<br>*<br>* @param TextField<br>* @param range<br>* @param string<br>*<br>* @return<br>*/<br>-(BOOL) textField: (uitextfield<em><em>) TextField shouldchangecharactersinrange: (nsrange) range replacementstring: (nsstring</em></em>) string{</p><pre><pre><code>NSLog(@"%ld %ld",range.length,range.location);NSLog(@"%@",string);return YES;</code></pre></pre><p><p>}//return NO to the change text<br>/**<br>* One-click Delete<br>*<br>* @param TextField<br>*<br>* @return No means delete is invalid<br>*/<br>-(BOOL) textfieldshouldclear: (uitextfield *) textfield{<br>If ([textfield.text isequaltostring:@ "123"]) {<br>Return NO;<br>}<br>NSLog (@ "%s",<strong>func</strong>);<br>Return YES;<br>}//called when Clear button Pressed. Return no to ignore (no NOTIFICATIONS)<br>/**<br>* Textfieldshouldreturn<br>*<br>* @param TextField an incoming keyboard<br>*<br>* @return<br>*/<br>-(BOOL) textfieldshouldreturn: (uitextfield *) textfield{<br>Retract keyboard: cursor disappears input box loses first response<br>[textField resignfirstresponder];<br>NSLog (@ "%s",<strong>func</strong>);<br>Return YES;<br>}//called when ' return ' key Pressed. return NO to Ignore.</p></p> <p><p>Uitextfield of iOS Learning UI</p></p></span>
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