首页 / IOS / iOS UI05_Control
iOS UI05_Control
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了iOS UI05_Control,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4418字,纯文字阅读大概需要7分钟。
内容图文
毛玻璃效果
动态图
音频
滑块
点击条
//
// MainViewController.m
// UI05_Control
//
// Created by dllo on 15/8/4.
// Copyright (c) 2015年 zhozhicheng. All rights reserved.
//
#import "MainViewController.h"
#import <AVFoundation/AVFoundation.h>
@interface
MainViewController ()
@property(nonatomic,retain)UIStepper *stepper;
@property(nonatomic,retain)AVAudioPlayer *play;
@property(nonatomic,retain)UIImageView *tomCatImageView;
@property(nonatomic,retain)NSMutableArray *picArr;
//滑块视图@property(nonatomic,retain)UISlider *slider;
@end@implementationMainViewController
-(void)dealloc
{
[_stepper release];
[_play release];
[_tomCatImageView release];
[_picArr release];
[_slider release];
[super dealloc];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.// self.stepper=[[UIStepper alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];// [self.view addSubview:self.stepper];// [_stepper release];// self.stepper.stepValue=2;// [self.stepper addTarget:self action:@selector(stepAction:) forControlEvents:UIControlEventValueChanged];// NSString *path=[[NSBundle mainBundle] pathForResource:@"李白" ofType:@"mp3"];// self.play=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];// [self.play play];// [_play release];// UIImageView *imageView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"footRight_15.jpg" ]];// imageView.frame=CGRectMake(0, 0, self.view.frame.size.width, 500);// [self.view addSubview:imageView];// [imageView release];// // //先创建一个毛玻璃的效果// UIBlurEffect *effect=[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];// //创建一个毛玻璃视图 ,指定效果// UIVisualEffectView *effectView=[[UIVisualEffectView alloc] initWithEffect:effect];// effectView.alpha=0.7;// effectView.frame=imageView.frame;// [imageView addSubview:effectView];//播放gif图self.tomCatImageView=[[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 200, 400)];
[self.view addSubview:self.tomCatImageView];
[_tomCatImageView release];
//对容器进行初始化self.picArr =[NSMutableArray array];
for (NSInteger i =0; i<24; i++) {
//拼接图片的名称// NSLog(@"%02ld",i);NSString *picName=[NSString stringWithFormat:@"pie_%0.2ld.jpg",i];
// NSLog(@"%@",picName);//根据图片名找到对应的图片UIImage *image=[UIImage imageNamed:picName];
//把图片添加到数组中
[self.picArr addObject:image];
}
self.tomCatImageView.animationImages=self.picArr;
self.tomCatImageView.animationDuration=5;
self.tomCatImageView.animationRepeatCount=1000;
[self.tomCatImageView startAnimating];
self.slider = [[UISlider alloc] initWithFrame:CGRectMake(80, 500, 200, 20)];
[self.view addSubview:self.slider];
[_slider release];
//最大值 最小值self.slider.minimumValue=0.5;
self.slider.maximumValue=5;
[self.slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
//// NSArray *segmentedArray = [[NSArray alloc]initWithObjects:@"1",@"2",@"3",@"4",nil];// UISegmentedControl *segment=[[UISegmentedControl alloc] initWithItems:segmentedArray];// segment.frame=CGRectMake(80, 550, 200, 40);// [self.view addSubview:segment];// segment.layer.borderWidth=1;// segment.selectedSegmentIndex=4;// segment.tintColor=[UIColor blackColor];// [segment addTarget:self action:@selector(segAction:) forControlEvents:UIControlEventValueChanged];// [segment release];
}
//-(void)segAction:(UISegmentedControl *)seg//{// //按钮默认从0开始// NSLog(@"%ld",seg.selectedSegmentIndex);//}
-(void)sliderAction:(UISlider *)slider
{
NSLog(@"%g",slider.value);
//播放时长,被slider控制self.tomCatImageView.animationDuration= self.slider.value;
[self.tomCatImageView startAnimating];
}
//-(void)stepAction:(UIStepper *)stepper//{// NSLog(@"%g",stepper.value);// self.play.volume=self.stepper.value;//// // //}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/@end
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/cheng_xiansheng/article/details/47291203
内容总结
以上是互联网集市为您收集整理的iOS UI05_Control全部内容,希望文章能够帮你解决iOS UI05_Control所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。