IOS Learning Note Control--Lan Yi Education

Source: Internet
Author: User

UIlabel *l1 Lan Yi Education

Text

Font

Set font

Set Center L1 settextalignment:nstextalignmentcenter

Set Number of rows NumberOfLines

Lf.font = [Uifont fontwithname:@ "font name" size:18];

Set Center

[L Settextalignment:nstextalignmentcenter];

UIbutton

Content Settitle UI

Button Buttonwithtype (there are several styles storyboard visible in general with less because of project with picture buttons)

Button setimage normal state normal highlight state highlighted checked state selected disabled state disabled

Four states can be set in storyboard with an enabled tick off is disabled STATECONFLG can be set in different states

Buttons can be clicked to remove themselves from the settings (UIButton *) btn directly in the clicked method remove

Uitextfield

Code cannot be displayed directly because BorderStyle is not set

The property is out. Can also be called with Set method settings such as Setboderstyle

textfield.delegate=self text input Box Reverse call

The second part is to add a meeting agreement.

The text input box has some point in time

Clearbutton is always appears status shows that little X

UISlider (is similar to the control volume that can adjust the maximum minimum value adjustment three pictures callable method)

UISlider *s = [[UISlider alloc]initwithframe:cgrectmake (50, 100, 250, 30)];

S.maximumvalue = 30;

S.minimumvalue = 10;

S.value = 20;

[s Setmaximumtrackimage:[uiimage imagenamed:@ "B"] forstate:uicontrolstatenormal];

[s Setminimumtrackimage:[uiimage imagenamed:@ "C"] forstate:uicontrolstatenormal];

[s Setthumbimage:[uiimage imagenamed:@ "a"] forstate:uicontrolstatenormal];

[S addtarget:self action: @selector (slider2action:) forcontrolevents:uicontroleventvaluechanged];

[Self.view addsubview:s];

method to invoke

-(void) Slider2action: (UISlider *) s{

NSLog (@ "%f", S.value);

}

SC is a control of two or three components

-(Ibaction) Scvaluechange: (Uisegmentedcontrol *) Sender {

The output of the currently selected index is starting at 0

int x = Sender.selectedsegmentindex;

NSLog (@ "%d", x);

Outputs the currently selected title

NSString *title = [Sender titleforsegmentatindex:1];

NSLog (@ "%@", title);

}

Progress bar Uiprogressview (no interaction can only associate attributes)

The statement is called attribute *pro1;

Open a 1-second Yes Timer

-(void) {

self.pro1.progress+=0.1;

}

The progress property of Uiprogressview is the progress value above meaning the progress of each second is +0.1 length

You can set the start position of the progress in storyboard and set both sides as a picture

Uiswitch (switch storyboard to select Uiswitch when creating an associated event)

-(Ibaction) Swtich1: (Uiswitch *) Sender {

if (Sender.ison) {

Sender.ison So here is the event that the switch is open;

}else{

Here the write switch closes the event that occurs;

}

}

Uistepper (Correlate into event note set to Uistepper)

There is an important attribute of value indicating that his current number

You can set value,step and so on when storyboard create Uistepper

Step indicates no + value Added value

-(Ibaction) Uistepper1: (Uistepper *) Sender {

Self.number.text=[nsstring stringwithformat:@ "%f", Sender.value];

}//The last value used is Sender.value

Uiactivityindicatorview (association attribute) commonly known as Chrysanthemum

You can change the style and color when storyboard is created

There are two ways of doing this:

Correlate into Self.juhua

1. Start the animation [Self.juhua startanimating];

2. Stop animation [Self.juhua stopanimating];

-(Ibaction) Swtich1: (Uiswitch *) Sender {

if (Sender.ison) {

[Self.juhua startanimating];

}else{

[Self.juhua stopanimating];

}

}//When switch is turned on, the Chrysanthemum turns when the switch is turned off.

IOS Learning Note Control--Lan Yi Education

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.