UIActivityIndicatorView

UIActivityIndicatorView
使用一个活动指示器来显示一个任务正在进行中。活动指标出现“齿轮”,要么是旋转或停止。
(1)初始化活动指示器
initWithActivityIndicatorStyle:初始化活动指示器 ,并返回活动指示器对象,管理指示器 UIActivityIndicatorViewStyleWhiteLarge, UIActivityIndicatorViewStyleWhite, UIActivityIndicatorViewStyleGray

(2)控制指示器的开始和结束
- startAnimating:
- stopAnimating

(3)当动画停止时,是否隐藏指示器,返回bool
hidesWhenStopped
A Boolean value that controls whether the receiver is hidden when the animation is stopped.
Configuring the Activity Indicator Appearance

(4)指示器的样式
activityIndicatorViewStyle

(5)旋转指示器的颜色
color

(6)指示器的样式集
UIActivityIndicatorViewStyle

(7)初始化器
- initWithCoder:
- initWithFrame:

(8)属性,指示器在旋转
animating

使用方式就是
UIActivityIndicatorView *testActivityIndicator = [UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]];
testActivityIndicator.center = CGPointMake(100.0f, 100.0f);//只能设置中心,不能设置大小
[testActivityIndicator setFrame = CGRectMack(100, 100, 100, 100)];//不建议这样设置,因为UIActivityIndicatorView是不能改变大小只能改变位置,这样设置得到的结果是控件的中心在(100,100)上,而不是和其他控件的frame一样左上角在(100, 100)长为100,宽为100.
[self addSubview:testActivityIndicator];
testActivityIndicator.color = [UIColor redColor]; // 改变圈圈的颜色为红色; iOS5引入
[testActivityIndicator startAnimating]; // 开始旋转
[testActivityIndicator stopAnimating]; // 结束旋转
[testActivityIndicator setHidesWhenStopped:YES]; //当旋转结束时隐藏

还有一个是isAnimating方法,返回一个BOOL值,可以用这个方法来判断控件是否在旋转

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员的修养

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值