该源码案例是一款不错的联网指示器效果,源码ZZProgressHUD,希望这个案例能够帮到大家的学习和使用,iOS源码频道。 - (id)initWithFrame:(CGRect)frame andStyle:(WMProgressStyle)styleType andTitle:(NSString *)title ZZProgressHUD. { if (self = [super initWithFrame:frame]) { _frame = frame; self.styleType = styleType; self.titleStr = title; [self createProgress]; } return self; } - (void)createProgress { //create backgroundView self.progressView = [[UIView alloc]initWithFrame:_frame]; self.progressView.alpha = 0.5; self.progressView.backgroundColor = [UIColor blackColor]; [self addSubview:_progressView]; //activityView self.activityView = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(_frame.size.width/2, _frame.size.height/2-10, 0, 0)]; [self.progressView addSubview:self.activityView]; if (self.styleType == defaultStyle) { self.activityView.activityIndicatorViewStyle = 0; } if (self.styleType == titleStyle) { UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, _frame.size.height/2+5, _frame.size.width, 30)]; titleLabel.textAlignment = NSTextAlignmentCenter; titleLabel.textColor = [UIColor whiteColor]; titleLabel.font = [UIFont systemFontOfSize:12]; titleLabel.text = self.titleStr; [self.progressView addSubview:titleLabel]; } } - (void)startWMProgress { [self.activityView startAnimating]; } - (void)stopWMProgress { [self.activityView stopAnimating]; for (UIView *view in self.subviews) { [view removeFromSuperview]; } }
- 1
- 粉丝: 4
- 资源: 936
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助