tag: uitextfield uilabel uibutton
</PRE> <PRE name = "code" class = "CPP"> 1. uilabel is a control developed in IOS to display text. It is a subclass of uiview. Therefore, all the functions of uiview only provide more text display functions than that of uiview. The procedure of using uilabel is as follows: 1. create object 2. configure properties 3. add to parent View 4. release ownership focus: different controls only have different properties configured, that is, the difference. To learn a new control, you only need to configure the unique properties of the control. create object uilabel * view = [[uilabel alloc] initwithframe: cgrectmake (60,234,200,100)]; 2. set the text view displayed on the label. TEXT = @ "Beauy: beauybeauybeauy"; 3. set the text size on the label. // 1. set the font style // 2. set the font size // systemfontofsize the default font of the system is used by default. You can change the size of the view. font = [uifont systemfontofsize: 25]; view. font = [uifont fontwithname: @ "thonburi-bold" Size: 25]; // [uifont familynames] obtain the name in the font family // nslog (@ "% @", [uifont familynames]); // nslog (@ "% @", [uifont fontnamesforfamilyname: @ "thonburi"]); 4. font color view. textcolor = [uicolor yellowcolor]; 5. set the text alignment style view. textalignment = nstextalignmentcenter; 6. set Text wrap // if no limit is set on the number of lines, set the value to 0 view. numberoflines = 0; 7. standard (Text truncation principle) view of line feed. linebreakmode = nslinebreakbywordwrapping; 8. sets the shadow offset view. shadowoffset = cgsizemake (0, 0); 9. shadow color view. shadowcolor = [uicolor redcolor]; 2. uitextfield is a subclass of uicontrol, and uicontrol is a subclass of uiview, so it is a view, but there are two more functions than uiview: text display and text editing // uitextfield use steps are the same as uiview 1. create an object: uitextfield * textfield = [[uitextfield alloc] initwithframe: cgrectmake (40, 50,240, 30)]; textfield. backgroundcolor = [uicolor yellowcolor]; 2. set the border style textfield. borderstyle = uitextborderstyleroundedrect; 3. set the default display (prompt text) text, but not as part of the text textfield. placeholder = @ "mobile phone number/email"; 4. set textfield to start displaying text. TEXT = @ "mobile phone number"; 5. set the text color textfield. textcolor = [uicolor redcolor]; 6. sets textfield for text alignment. textalignment = nstextalignmentcenter; 7. set the text font // textfield. font = [uifont fontwithname: @ "thonburi" Size: 35]; 8. sets whether the input box can edit textfield. enabled = yes; 9. sets whether to clear textfield in the input box when editing starts. clearsonbeginediting = yes; 10. set the password mode. Whether the content in the input box displays textfield in the form of vertices. securetextentry = yes; 11. set the pop-up keyboard style textfield. keyboardtype = uikeyboardtypeasciicapable; 12. the style textfield displayed in the lower right corner of the keyboard. returnkeytype = uireturnkeydefault; 13. steps for using a proxy: 1. set proxy 2. obey Protocol 3. the method textfield in the implementation protocol. delegate = self; 14. custom input view (default keyboard) uiview * view = [[uiview alloc] initwithframe: cgrectmake (20, 50, 20, 50)]; textfield. inputview = view; [_ containview addsubview: textfield]; [textfield release];} // when you click return in the lower right corner, the-(bool) textfieldshouldreturn (uitextfield *) is triggered *) textfield {// reclaim the keyboard and cancel the first responder [textfield resignfirstresponder]; return yes;} 3. uibutton * button = [uibutton buttonwithtype: uibuttontypesystem]; button. frame = cgrectmake (50,400,220, 40); button. backgroundcolor = [uicolor browncolor]; 1. set the rounded corner button. layer. cornerradius = 5; 2. add a click event to the button // Let the target execute the action method. After the controlevents event occurs, // CLICK: The following parameter: Who calls addtarger: Action: method, and who is the parameter, the parameter can only have one [Button addtarget: Self action: @ selector (Click :) forcontrolevents: uicontroleventtouchupinside]; 3. set text for button [Button settitle: @ "OK" forstate: uicontrolstatenormal]; 4. change the text color [Button settitlecolor: [uicolor redcolor] forstate: uicontrolstatenormal]; [_ containview addsubview: button];}-(void) Click :( uibutton *) button {nslog (@ "% @", button); nslog (@ "Cong Lei beat Cheng Jie ");}