MBProgressHUD 扩展加载动画
2016-04-14 22:13
211 查看
效果图: 设计给了一个组的图片,但是由于是透明的背景,会产生卡顿,其实只要两张图片就可以了 创建一个 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; }
相关文章推荐
- LeetCode *** 162. Find Peak Element
- Android Studio 无法引用org.apache.http解决办法
- 小译UnityAPI-Awake,Start,Reset
- 子数组之和为零 lintcode
- 使用jspSmartUpload组件进行文件上传、下载
- ubuntu 14.04 x64下安装libreoffice
- 设置xx-net,访问youtube等国外网站
- 【leetcode】225. Implement Stack using Queues
- 【弱校胡策】2016.4.14 (bzoj2164)最短路+状压DP+矩阵乘法+高斯消元+树链剖分+线段树+背包DP
- eglMakeCurrent, eglSwapBuffers, glFlush, glFinish
- mysql5.7.11编译安装以及修改root密码小结
- Centos 7.0 忘记密码,如何重置
- 学习
- DSS 搭建手机流媒体服务器
- showModelDialog的使用(二):提供下载功能
- 深入浅出 JavaScript 中的 this
- 在IIS7.5打开网页的时候,提示: HTTP 错误 500.0 - Internal Server Error 调用 LoadLibraryEx 失败,在 ISAPI 筛选器 "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll" 上。解决方法
- Score
- html标签属性大全
- showModelDialog的使用(一)