汇总:风火轮,进度条,页面指示器
UIActivityIndicatorView
风火轮
//UIActivityIndicatorView :风火轮
//UIActivityIndicatorViewStyleWhite 设置风格 ,一共有三种
UIActivityIndicatorView *indicator= [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
//设置背景颜色
indicator.backgroundColor= [UIColorredColor];
//透明度
indicator.alpha= 0.5;
//设置中心点
indicator.center=self.view.center;
//bounds大小
indicator.bounds=CGRectMake(0, 0, 50, 50);
//设置圆角
indicator.layer.cornerRadius= 10;
//超出父视图部分不显示
indicator.layer.masksToBounds=YES;
//添加到屏幕上
[self.viewa ddSubview:indicator];
//开始风火轮动画
[indicator startAnimating];
//停止风火轮动画
[indicator stopAnimating];
UIProgressView
进度条
// UIProgressView:进度条
UIProgressView *progress= [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
//设置进度条的位置和大小
progress.frame=CGRectMake(20, 80, 100, 30);
//progress.tintColor = [UIColor redColor];
//progress.backgroundColor = [UIColor purpleColor];
//progress.alpha = 0.5;
//进度值设置属性为progress
progress.progress= 0.1f;
//控制走过的轨迹的颜色
progress.progressTintColor= [UIColorgreenColor];
//未走过的颜色
progress.trackTintColor= [UIColorgrayColor];
//添加到视图上
[self.view addSubview:progress];
//setProgress设置平缓过度到某一个位置的方法
//[progress setProgress:0.8f animated:YES];
UIPageControl
页面指示器
//指示器页面小圆点 ,通常和scrollView或者其子类一起使用 ,利用定时器来改变
UIPageControl *page= [[UIPageControl alloc] initWithFrame:CGRectMake(([[UIScreenmain Screen]bounds].size.width-100)/2.0, 100, 100, 40)];
//点数页数
page.numberOfPages= 7;
//page.backgroundColor = [UIColor orangeColor];
//点点的颜色
page.pageIndicatorTintColor= [UIColorgreenColor];
//page.tintColor = [UIColor greenColor];
//当前页点的颜色
page.currentPageIndicatorTintColor= [UIColororangeColor];
//当前显示页面
page.currentPage= 2;
[self.view addSubview:page];
[NSTimerscheduledTimerWithTimeInterval:1target:selfselector:@selector(move)userInfo:nilrepeats:YES];
- (void)move {
staticinta=0;
staticinti= 1;
a +=i;
page.currentPage= a;
if(a==6) {
i=-1;
} if(a==0){
i=1;
}
}