事件控件2

汇总:风火轮,进度条,页面指示器


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;
}
}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • VLC的集成和使用 VLC介绍 VLC Media Player (VideoLAN) 为 Windows、Lin...
    Pocket阅读 20,403评论 75 66
  • /*************** 1.分段选取器 ********************///参数数组里存放的是...
    037e3257fa3b阅读 170评论 0 0
  • 技术无极限,从菜鸟开始,从源码开始。 由于公司目前项目还是用OC写的项目,没有升级swift 所以暂时SDWebI...
    充满活力的早晨阅读 12,863评论 0 2
  • 时间并没有白白流逝,而是把多余的、不快的、腐败的东西冲刷下来带走了。时间就是忘却。它使古旧的东西变得美丽,...
    安安Ann阅读 215评论 0 0
  • 今天听了武志红的几个音频,讲的还是关于心理学的东西。还是讲到真正的自我、别人眼中的自我。我们需要对自己有清醒的认识...
    天龙糖果阅读 317评论 0 1

友情链接更多精彩内容