MBProgressHUD自定义图片
作者:
爱上火烧的小毛驴 | 来源:发表于
2017-04-27 16:10 被阅读578次
load.gif
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.labelText = @"登录中";
// 设置图片
UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"wechat_moment"]];
hud.customView = imgView;
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
//默认是顺时针效果,若将fromValue和toValue的值互换,则为逆时针效果
animation.fromValue = [NSNumber numberWithFloat:0.f];
animation.toValue = [NSNumber numberWithFloat: M_PI *2];
animation.duration = 1;
animation.autoreverses = NO;
animation.fillMode =kCAFillModeForwards;
animation.repeatCount = MAXFLOAT; //如果这里想设置成一直自旋转,可以设置为MAXFLOAT,否则设置具体的数值则代表执行多少次
[imgView.layer addAnimation:animation forKey:nil];
// 再设置模式
hud.mode = MBProgressHUDModeCustomView;
// 隐藏时候从父控件中移除
hud.removeFromSuperViewOnHide = YES;
// 1秒之后再消失
[hud hide:YES afterDelay:0.7];
本文标题:MBProgressHUD自定义图片
本文链接:https://www.haomeiwen.com/subject/tkqnzttx.html
网友评论