码迷,mamicode.com
首页 > 其他好文 > 详细

UI----安健2 UIswitch UIslider

时间:2015-05-07 16:12:12      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

- (void)viewDidLoad { [super viewDidLoad]; [self buttonswitch]; [self buttonslider]; } -(void)buttonswitch { // UIswitch self.view.backgroundColor = [UIColor whiteColor]; UISwitch *switc = [[UISwitch alloc]init]; switc.frame = CGRectMake(50, 50, 50, 50); switc.thumbTintColor = [UIColor redColor]; switc.onTintColor = [UIColor blackColor]; switc.tintColor = [UIColor yellowColor]; [switc addTarget:self action:@selector(buttonswitch:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:switc]; } -(void)buttonswitch:(UIView *)serder { UISwitch *change = (UISwitch *)serder; BOOL tees = change.isOn; if (tees==YES) { self.view.backgroundColor = [UIColor grayColor]; }else { self.view.backgroundColor = [UIColor brownColor]; } } -(void)buttonslider { // UIslider UISlider *slider = [[UISlider alloc]initWithFrame:CGRectMake(50, 100, 200, 10)]; slider.maximumValue = 1.0; slider.minimumValue = 0.0; slider.maximumTrackTintColor = [UIColor yellowColor]; slider.minimumTrackTintColor = [UIColor brownColor]; slider.thumbTintColor = [UIColor redColor]; [slider addTarget:self action:@selector(buttonslider:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:slider]; } -(void)buttonslider:(UIView *)serder { UISlider *hange = (UISlider *)serder; NSLog(@"%f",hange.value); }

UI----安健2 UIswitch UIslider

标签:

原文地址:http://www.cnblogs.com/daijiahong/p/4485029.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!