码迷,mamicode.com
首页 > 其他好文 > 详细

MBProgressHUD 扩展加载动画

时间:2016-04-15 00:20:38      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:

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

创建一个 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;
}

 

MBProgressHUD 扩展加载动画

标签:

原文地址:http://www.cnblogs.com/10-19-92/p/5393286.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!