关于MBProgressHUD自定义帧动画
2016-01-29 09:29
696 查看
现在很多APP的HUD已经都是自定义动画了,MBProgressHUD没有开放的API可以让我们直接使用,需要到.m文件中去修改源码。
首先在.m文件中找到
- (void)updateIndicators
方法在
if (mode == MBProgressHUDModeIndeterminate) {}
中自定义动画,然后上代码:
感兴趣的朋友可以尝试一下
首先在.m文件中找到
- (void)updateIndicators
方法在
if (mode == MBProgressHUDModeIndeterminate) {}
中自定义动画,然后上代码:
<span style="font-size:18px;">if (mode == MBProgressHUDModeIndeterminate) { if (!isActivityIndicator) { // Update to indeterminate indicator [indicator removeFromSuperview]; self.indicator = MB_AUTORELEASE([[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]); self.indicator = MB_AUTORELEASE([[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 70, 40)]); self.indicator.contentMode = UIViewContentModeScaleAspectFit; // [(UIActivityIndicatorView *)indicator startAnimating]; [self addSubview:indicator]; for (int i=0; i<24; i++) { [_loadingArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"loading_%d",i + 1]]]; } //设置动画数组 [(UIImageView *)self.indicator setAnimationImages:_loadingArray]; //设置动画播放次数 [(UIImageView *)self.indicator setAnimationRepeatCount:MAXFLOAT]; //设置动画播放时间 [(UIImageView *)self.indicator setAnimationDuration:1.5]; //开始动画 [(UIImageView *)self.indicator startAnimating]; } #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000 if ([indicator isKindOfClass:[UIActivityIndicatorView class]]) { [(UIActivityIndicatorView *)indicator setColor:self.activityIndicatorColor]; } #endif }</span>
感兴趣的朋友可以尝试一下
相关文章推荐
- POJ 3009(Dfs)
- 微信抢红包
- JavaScript判断DIV内容是否为空的方法
- Java程序员在用的大数据工具
- IDS与防火墙
- 基于javascript实现listbox左右移动
- QQ通信原理及QQ是怎么穿透内网进行通信的
- db2top详解
- 媒体查询
- 图像_一些基本概念
- 统计每个月兔子的总数
- IOS--APP企业发布:in-house方式
- Android 中文件类型与MIME的匹配表
- 爬虫超时解决的方法
- 课后题 3-3 水题
- 【Spring】java.lang.IndexOutOfBoundsException: Index: 256, Size: 256
- android-Designing Effective Navigation,Planning Screens and Their Relationships
- Umbraco(5)-Creating Master Template Part 1
- SpringMVC工作环境搭建 配置文件
- startexplorer插件——eclipse