UISlider, UISlider
 
// Create UISlider. The height is a value, but cannot be set to 0.
 
// Slide if the height is 0
 
UISlider * slider = [[UISlideralloc] initWithFrame: CGRectMake (200, 10)];
 
 
// Set the maximum value. Do not set the inverse value. Otherwise, you cannot slide.
 
Slider. maximumValue = 1;
 
Slider. minimumValue = 0;
 
 
// Set the initial value of the row.
 
Slider. value =. 5;
 
// [Slider setValue:. 5 animated: YES];
 
 
// Create an image that needs to be displayed on the sliding button
 
UIImage * img1 = [UIImageimageNamed: @ "com_thumb_max_n-Decoded"];
 
UIImage * img2 = [UIImageimageNamed: @ "com_thumb_max_h-Decoded"];
 
 
// Set the image of the sliding button
 
[Slider setThumbImage: img1forState: UIControlStateNormal];
 
[Slider setThumbImage: img2forState: UIControlStateHighlighted];
 
 
UIImage * sliderImg1 = [UIImageimageNamed: @ "com_slider_min_l-Decoded"];
 
UIImage * sliderImg2 = [UIImageimageNamed: @ "com_slider_max_l-Decoded"];
 
 
// Set the stretch point (------ key ------)
 
SliderImg1 = [sliderImg1 stretchableImageWithLeftCapWidth: 10 topCapHeight: 0];
 
SliderImg2 = [sliderImg2 stretchableImageWithLeftCapWidth: 10 topCapHeight: 0];
 
 
 
// Set the picture displayed by the row
 
[Slider setMinimumTrackImage: sliderImg1forState: UIControlStateNormal];
 
[Slider setMaximumTrackImage: sliderImg2forState: UIControlStateNormal];
 
 
// Set the color of the row.
 
// [Slider setMinimumTrackTintColor: [UIColor redColor];
 
// [Slider setMaximumTrackTintColor: [UIColor greenColor];
 
 
// Add a slide event
 
[Slider addTarget: selfaction: @ selector (sliderAction :) forControlEvents: UIControlEventValueChanged];
 
 
[_ Window addSubview: slider];
 
 
 
 
 
/* ------------------------ Use of UISwitch ----------------------*/
 
// Fixed in width and height
 
UISwitch * swithch = [[UISwitchalloc] initWithFrame: CGRectMake (90,90, 0, 0)];
 
 
// Set the status of the switch. The switch is disabled by default.
 
// Swithch. on = YES;
 
[Swithch setOn: YESanimated: YES];
 
 
[Swithch addTarget: selfaction: @ selector (switchAction :) forControlEvents: UIControlEventValueChanged];
 
 
[_ Window addSubview: swithch];
 
 
 
 
 
 
Return YES;
 
}
 
 
 
-(Void) sliderAction :( UISlider *) slider {
 
 
NSLog (@ "slider: %. 2f", slider. value );
 
 
}
 
 
-(Void) switchAction :( UISwitch *) sw {
 
 
If (sw. on = YES ){
 
NSLog (@ "enabled ");
 
} Else {
 
NSLog (@ "off ");
 
}
 
 
}