MBProgressHUD 扩展加载动画

效果图:   设计给了一个组的图片,但是由于是透明的背景,会产生卡顿,其实只要两张图片就可以了


创建一个 MBProgressHUD 分类 增加方法

+ (MB_INSTANCETYPE)myShowHUDAddedTo:(UIView *)view animated:(BOOL)animated {
    if (view == nil) view = [[UIApplication sharedApplication].windows lastObject];
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:animated];
    hud.margin = 0;
    hud.color = [UIColor clearColor];

    UIView *customV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
    UIImageView *backImage = [[UIImageView alloc] initWithFrame:customV.bounds];
    backImage.image = [UIImage imageNamed:@"R-shadow"];
    [customV addSubview:backImage];
   
    UIImageView * imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
    [customV addSubview:imgView];
    CGPoint pppp = imgView.center;
    pppp.y -= 20;
    imgView.image = [UIImage imageNamed:@"R-ball"];
    [UIView beginAnimations:@"movement" context:nil];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
    [UIView setAnimationDuration:0.5f];
    [UIView setAnimationRepeatCount:1000];
    [UIView setAnimationRepeatAutoreverses:YES];
    imgView.center = pppp;
    [UIView commitAnimations];

    hud.customView = customV;
    hud.removeFromSuperViewOnHide = YES;   // 隐藏时候从父控件中移除
    hud.mode = MBProgressHUDModeCustomView;
   
    return hud;
}

 

转载于:https://www.cnblogs.com/10-19-92/p/5393286.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值