iOS Note Uikit_uislider/uistepper/uiswitch

Source: Internet
Author: User

-(void) Viewdidload {

[Super Viewdidload];

SELF.SP = [[Uistepper alloc]init];

Set the position of the pedometer

Self.sp.center = cgpointmake (100, 100);

Pedometer minimum and maximum values

Self.sp.minimumValue = 0;

Self.sp.maximumValue = 10;

Set step step value for pedometer

Self.sp.stepValue = 1.0;

Do you press the constant change value

Self.sp.autorepeat = YES;

Add a Click event

[Self.sp addtarget:self Action: @selector (ValueChange:) forcontrolevents:uicontroleventtouchupinside];

[Self.view ADDSUBVIEW:SELF.SP];

Setting the slider

SELF.SD = [[UISlider alloc]init];

Self.sd.center = Cgpointmake (200, 300);

Self.sd.maximumValue = 100;

Self.sd.minimumValue = 10;

Style on both sides of the slider

Self.sd.minimumTrackTintColor = [Uicolor Redcolor];

Self.sd.maximumTrackTintColor = [Uicolor Bluecolor];

You can set the picture on both sides

Self.sd.minimumValueImage = [UIImage imagenamed:@ ""];

Self.sd.maximumValueImage = [UIImage imagenamed:@ ""];

Adding sliding events

[Self.sd addtarget:self Action: @selector (ValueChange1:) forcontrolevents:uicontroleventtouchupinside];

[Self.view ADDSUBVIEW:SELF.SD];

}

is a change in value

-(void) ValueChange: (uistepper*) sp{

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

}

-(void) ValueChange1: (uislider*) sd{

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

}

#pragma mark-Switch space properties and on and off

-(void) switchvaluechanged: (Uiswitch *) SW

{

if (Sw.on)

{

NSLog (@ "open");

}

Else

{

NSLog (@ "off");

}

iOS notes Uikit_uislider/uistepper/uiswitch

Related Article

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.