-
UISegmentedControl(分页控制器) AND UISlider(滑块控制器)
-
- (void)viewDidLoad
-
{
-
[super viewDidLoad];
-
-
UIImageView * animatedImageView = [[UIImageView alloc]initWithFrame:CGRectMake(60, 80, 200, 300)];
-
animatedImageView.backgroundColor = [UIColor redColor];
-
animatedImageView.tag = 100;
-
[self.view addSubview:animatedImageView];
-
[animatedImageView release];
-
-
NSMutableArray * arrayImages = [NSMutableArray array];
-
for (int i = 1; i < 8; i++) {
-
-
[arrayImages addObject:[UIImage imageNamed:[NSString stringWithFormat:@"huoju_%i.tiff",i]]];
-
-
}
-
-
animatedImageView.animationImages = arrayImages;
-
-
#pragma mark - 分段控制器
-
-
UISegmentedControl * segment = [[UISegmentedControl alloc]initWithItems:@[@"statr",@"stop",@"HMT"]];
-
segment.frame = CGRectMake(10, 20, 300, 40);
-
-
NSLog(@"%lu",segment.numberOfSegments);
-
-
segment.momentary = YES;
-
[segment addTarget:self action:@selector(onClickSegmentedControl:) forControlEvents:UIControlEventValueChanged];
-
-
[self.view addSubview:segment];
-
[segment release];
-
-
-
-
UISlider * slider = [[UISlider alloc]initWithFrame:CGRectMake(10, 500, 300, 40)];
-
slider.maximumValue = 3;
-
slider.minimumValue = 0.1;
-
NSLog(@"%f",slider.value);
-
[self.view addSubview:slider];
-
[slider release];
-
[slider addTarget:self action:@selector(changeSliderValue:) forControlEvents:UIControlEventValueChanged];
-
-
}
-
-
-
- (void)onClickSegmentedControl:(UISegmentedControl *)segmented{
-
-
-
if (segmented.selectedSegmentIndex == 0) {
-
-
[((UIImageView *)[self.view viewWithTag:100]) startAnimating];
-
-
} else {
-
-
[((UIImageView *)[self.view viewWithTag:100]) stopAnimating];
-
-
}
-
}
-
-
- (void)changeSliderValue:(UISlider *)sLider{
-
-
-
((UIImageView *)[self.view viewWithTag:100]).animationDuration = sLider.value;
-
[((UIImageView *)[self.view viewWithTag:100]) startAnimating];
-
}
-
-
-
- (void)didReceiveMemoryWarning
-
{
-
[super didReceiveMemoryWarning];
-
-
}
-
相关阅读:
gj10 python socket编程
自定义Git
使用GitHub
标签管理之操作标签
标签管理之创建标签
标签管理
git分支管理之多人协作
git分支管理之Feature分支
git分支管理之Bug分支
git分支管理之分支管理策略
-
原文地址:https://www.cnblogs.com/blfshiye/p/4266140.html
Copyright © 2020-2023
润新知