# #DAY2 UILabel, Uitextfield, UIButton, Uiimageview, UISlider

Source: Internet
Author: User

# #DAY2 UILabel, Uitextfield, UIButton, Uiimageview, UISlider

#pragma mark ——————— UILabel ———————————

Uilabel Properties:

Text: Textual content

TextColor: Color of content

TextAlignment: Alignment (horizontal direction)

Font: Fonts

NumberOfLines: Number of rows

Linebreakmode: Break mode

Shadowcolor: Shadow Color

Shadowoffset: Shadow Size (shadow to x positive to offset A, y positive shift B)

#pragma mark ——————— Uitextfield ——————————

Uitextfield Text Display Properties:

Text: Textual content

TextColor: Color of content

TextAlignment: Alignment (horizontal direction)

Font: Fonts

PLACEHOLDER: placeholder string (the hint string given when there is no input)

Uitextfield. Control properties: Protocol <UITextInputTraits>

Securetextentry: Ciphertext input

Keyboardtype: Type of pop-up keyboard (enumeration value)

Returnkeytype: The return button type (enumeration value) in the lower right corner of the keyboard

Enabled: Allow input, default Yes, allow input

Clearsonbeginediting: Empty the input box when you start typing

Inputview: Custom input view (default is keyboard)

Inputaccessoryview: Enter the secondary view above the view (default nil)

Uitextfield Appearance Control Properties:

BorderStyle: Border Style (enumeration value)

Clearbuttonmode: Clear button Mode (enumeration value)

Leftview: Input Box left view

Leftviewmode: Display mode for left view

Rightview: Right view of the input box

Rightviewmode: Display mode for the right view

Uitextfield Agent Law:<uitextfieldview> Agreement

When TextField is going to start editing, tell the delegate?

-(BOOL) textfieldshouldbeginediting: (Uitextfield *) TextField;

When TextField has been edited, tell the delegate?

-(void) textfielddidbeginediting: (Uitextfield *) TextField;

When TextField is going to finish editing, tell the delegate?

-(BOOL) textfieldshouldendediting: (Uitextfield *) TextField;

When TextField has finished editing, tell the delegate?

-(void) textfielddidendediting: (Uitextfield *) TextField;

Replace characters in a range with another character

-(BOOL) TextField: (Uitextfield *) TextField Shouldchangecharactersinrange: (nsrange) range replacementstring: ( NSString *) string;

Tells the client when the clear key on the keyboard is pressed

-(BOOL) Textfieldshouldclear: (Uitextfield *) TextField;

Tell the delegate when you click the Enter button on the keyboard?

-(BOOL) Textfieldshouldreturn: (Uitextfield *) TextField;

Ways to recycle your keyboard:

1) [View Endediting:yes] This method allows the entire view to cancel the first responder, thus allowing the keyboard of all controls to be hidden.

2) [textfiled Resignfirstresponder] This is more commonly used to let a textfiled keyboard hidden.

#pragma mark ——————— UIButton ———————————

Properties of the UIButton:

Frame: Layout

Adjustsimagewhenhighlighted: Highlight whether to change the picture (set the background image, whether there is a flashing effect, that is, whether the click is the highlight of the state, the default is YES)

UIButton Appearance Control Properties:

Setimage:forstate: Sets the foreground picture in the specified state

Imageforstate gets the foreground picture in the specified state

Setbackgroundimage:forstate: Sets the background picture in the specified state

Backgroundimageforstate: Gets the background picture in the specified state

Settitle:forstate: Sets the caption for the specified state (mandatory for the set caption)

Titleforstate gets the caption in the specified state

Settitlecolor:forstate: Sets the caption color in the specified state (button in Uibuttontypecustom State, set color required)

Titlecolorforstate: Gets the caption color in the specified state

Settitleshadowcolor:forstate: Sets the caption shadow color in the specified state

Titleshadowcolorforstate: Gets the caption shadow color in the specified state

Two types of buttons:

Uibuttontypecustom

Uibuttontypesystem

Attention:

Uibuttontypecustom is more flexible than uibuttontypesystem

Uibuttontypesystem will set some default styles, for example, the font color is blue

That is, Uibuttontypesystem does not give the title color can be displayed, but Uibuttontypecustom is not

Three states of the button:

UIControlStateNormal: Normal state

Uicontrolstatehighlighted: Highlight State

Uicontrolstateselected: Selected state

Attention:

Here are three states, the latter two can be used with the first combination

Reverse the existing state: button.selected =!button.selected;

A control event for a button:

UIControlEventTouchUpInside: Trigger After click

#pragma mark ——————— Uiimageview ———————————

Uiimageview: Specifically used as a display picture, photo frame

UIImage: Picture Object

Properties of the Uiimageview:

Animationimages: Set up a set of animated pictures that specify all the pictures to animate (an array)

Animationduration: Set the time to play a set of animated pictures

Animationrepeatcount: Set number of repetitions, default = 0, repeat

Methods of Uiimageview:

Startanimating Start Animation

Stopanimating End Animation

Modifying the rendering effect of a picture (setting the tile state of the picture) is useful in some controls that modify the state of the picture, such as when Uisegmentedcontrol sets a picture for one of the items:

[Imageview.image imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];

#pragma mark ——————— UISlider ———————————

UISlider Slider Control:

Properties of the UISlider:

Frame: Layout

MinimumValue: Default 0.0

MaximumValue: Default 1.0

Value: Sets the current value of the slider, default 0.0

Minimumtracktintcolor: Sets the color across the area, default blue

Control events for UISlider:

Trigger event when uicontroleventvaluechanged value is changed

#pragma mark ——————— Uiswitch ———————————

Uiswitch Switch button:

Properties of the Uiswitch:

Frame: Layout (the system's switch control size is OK, so the width height setting is not valid)

Ontintcolor: Sets the color of the switch when the state is turned on

Tintcolor: Set switch style color

Thumbtintcolor: Setting the switch button color

On: Status of the switch (BOOL)

Onimage: Set the picture when the switch is on (note: no longer works after IOS7)

Offimage: Set the picture when the switch is off (note: No longer works after IOS7)

Methods of Uiswitch:

Seton:animated: Manually set the switch status

Control events for Uiswitch:

Trigger event when uicontroleventvaluechanged value is changed

# #DAY2 UILabel, Uitextfield, UIButton, Uiimageview, UISlider

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.