https://blog.csdn.net/u010105969/article/details/51065513 之前也用过MBProgressHUD这个第三方库,创建活动指示器,用来提示用户 还好我找到了销毁该对象的方法,方法如下: - (void)hudWasHidden:(MBProgressHUD *)hud { // Remove HUD from screen when the
项目主页: MBProgressHUD 实例下载: 点击下载 快速上手: 当执行需要较长时间的任务时,使用MBProgressHUD最重要的一点是: 保证主线程是空闲的,这样可以使UI实时更新.因此: 建议在 主线程中使用 MBProgressHUD, 把其他你想要执行的任务放到其他的线程里: [MBProgressHUD showHUDAddedTo:self.view animated:YES]; :YES]; }); }); 如果你想配置 HUD,你可以使用由 showHUDAddedTo:animated: 方法返回的 MBProgressHUD 的实例. MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.mode = MBProgressHUDModeAnnularDeterminate [MBProgressHUD hideHUDForView:self.view animated:YES]; });
在开源中国iOS客户端中也用到了MBProgressHUD这个特效,主要作用为应用显示一个过渡的作用,常用于打开一个联网页面加载过程,防止出现假死现象,如果网速慢则告诉用户已经在很努力很努力的加载中 GitHub上下载地址:https://github.com/jdg/MBProgressHUD 源码中也自带了一个Demo,显示13中动画效果,可以根据需要选取其中特效加以使用,使用方法基本一样;使用的时候只加把 MBProgressHUD.h和MBProgressHUD.m拖入工程中,在使用的文件中加上#import"MBProgressHUD.h" 在开源中国iOS客户端中只用到一种特效,当我们选取一条资讯查看详细信息时 *hud = [[MBProgressHUD alloc] initWithView:self.view]; [Tool showHUD:isFav ? 对象,进行初始化 [ToolshowHUD:@"正在加载" andView:self.viewandHUD:hud];是在Tool类里面进行的一次封装,设置MBProgressHUD的显示信息 + (
iOS开发中-使用提示框的场景有不少,现在最常用的两种提示框 - MBProgressHUD && SVProgressHUD ,具体什么场景使用哪个各有各的经验,我以实际项目需求,简单讲解一下 两种提示框
MBProgressHUD 还是 SVProgressHUD ? github 流行度: MBProgressHUD - SVProgressHUD = 2500 截止目前, MBProgressHUD 的关注度为 8556, SVProgressHUD 的关注度为 接口易用性: MBProgressHUD == SVProgressHUD 以下是MBProgressHUD 和 SVProgressHUD 各自项目的github主页上,各自的基本用法示例: [MBProgressHUD ;这也是我最终决定选定 MBProgressHUD 并深入使用 MBProgressHUD的重要原因.初次之外, MBProgressHUD 还支持自定义部分进度条相关的属性.具体细节如下: @interface ,而我真的推荐你使用 MBProgressHUD.官方文档对MBProgressHUD的具体功能提的过于精简,希望能借助这篇文章,能让大家一起更全面的认识 MBProgressHUD.
本文介绍了一种易于使用的进度提示组件SVProgressHUD,它可以在应用程序中快速添加提示,提高了开发效率和用户体验。通过使用SVProgressHUD,开发者可以省去很多编写和适配的时间,从而提高开发效率。同时,SVProgressHUD具有多种样式,可以满足不同场景的需求。
比如R.Swift,RxSwift之类在项目中各处都大量使用的库 导入方法一、 再要使用的类头部import import Foundation import MBProgressHUD import Rswift 适合不常用的一些三方库 导入方法二、 自己在要导入的库上方再封装一层,就变成全局导入的了,比如 MBProgressHUD,先新建一个HUD.swift,然后在里面: import Foundation import MBProgressHUD ///弹窗加载提示 class func show() { MBProgressHUD.showAdded(to: viewToShow (), animated: true) } ///隐藏所有弹窗 class func hide() { MBProgressHUD.hide(for:
5.修复一个MBProgressHUD不消失的Bug ? 如上图,以及执行过[MBProgressHUD hideHUDForView:subVC.view];可是有一个MBProgressHUD指示器依然不消失,最后无奈修改了 MBProgressHUD.m NO; for (UIView *subview in subviewsEnum) { if ([subview isKindOfClass:self]) { ((MBProgressHUD *)subview).removeFromSuperViewOnHide = YES; [(MBProgressHUD *)subview hide:animated];
3.MBProgressHUD文字多时换行展示 ? @implementation MBProgressHUD (CXRExpand) + (void)showText:(NSString *)text image:(NSString *)image toView:(UIView *)view { if (view == nil) view = [[UIApplication sharedApplication] keyWindow]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; if (text.length>15) { hud.detailsLabelText hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"MBProgressHUD.bundle
1.为 view、layer添加光晕层:http://code.cocoachina.com/view/134038 20170905111440152.png 2.MBProgressHUD 封装https://github.com/lyc59621/MBProgressHUD-JDragon 20170905111806126.gif 3.仿百度云盘下拉菜单:http://
NSString *string = @"测试"; pab.string = string; if (pab == nil) { [MBProgressHUD showError:@"复制失败"]; }else { [MBProgressHUD showSuccess:@"已复制
来处理网络请求; 使用 MJExtension实现JSON到数据模型的自动转换; 使用 MJRefresh 实现下拉刷新与上拉加载更多的效果; 使用 Masonry 进行AutoLayout布局; 使用 MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.mode = MBProgressHUDModeText *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.mode = MBProgressHUDModeText * * 数据更新后,会自动更新视图. */ - (void)updateData { [MBProgressHUD showHUDAddedTo:self.view animated *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.mode = MBProgressHUDModeText
self.tableView reloadData];}核心代码应用代理管理 (AppDelegate.m)#import "AppDelegate.h"#include "common.h"#include <MBProgressHUD /MBProgressHUD.h>@implementation AppDelegate// 显示提示消息+(void)showHudMsg:(NSString*)msg{ dispatch_async (dispatch_get_main_queue(), ^{ switchHud = [MBProgressHUD showHUDAddedTo:UIApplication.sharedApplication.keyWindow NSString*)msg detail:(NSString*)info{ dispatch_async(dispatch_get_main_queue(), ^{ switchHud = [MBProgressHUD
. ├── Pods │ ├── Release │ │ ├── MBProgressHUD │ │ │ └── 0.6.1-5f908 │ │ │ └── MBProgressHUD.framework │ │ ├── MJExtension │ │ │ └── 3.2.200-fdf9f │ │ │ └── MJExtension.framework zhuanzhuan-168f1 │ │ └── lottie-ios.framework │ ├── Specs │ │ └── Release │ │ ├── MBProgressHUD 比如 MBProgressHUD podspec的 SHA1 前5位为5f908 ,版本0.6.1,release pod,那么pod在寻找该缓存的时候便会去 Pods/Release/MBProgressHUD
常用的第三方开源框架: 1.JSON json编码解码 2.GTMBase64 base64编码解码 3.TouchXML 解析 4.SFHFKeychainUtils 安全保存用户密码到keychain中 5.MBProgressHUD ASIHTTPRequest 等相关协议封装 7.EGORefreshTableHeaderView 下拉刷新代码 8.AsyncImageView 异步加载图片并缓存代码 9.类似setting的竖立也分栏程序 10.MBProgressHUD
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; // 这里收到信号是开始发送网络请求 [x subscribeNext :^(id x) { // 这里收到信号是网络请求返回 [MBProgressHUD hideHUDForView:self.view animated:
3.不在主线程语句更新UI,会很晚才有提示,有的直接崩溃 [MBProgressHUD showHUD]; dispatch_queue_t queue = dispatch_get_global_queue 如果下面这句(回到主线程)不加上,会有问题 dispatch_async(dispatch_get_main_queue(), ^{ [MBProgressHUD
但是,如果我们的整体布局并不是只有一个UITableView,或者我们在项目中需要用到MBProgressHUD框架时,我们可能就不能直接将我们的控制器设置成UITableViewController或其子类 ,因为MBProgressHUD框架在UITableViewController和UICollectionViewController中显示会存在一些bug,在GitHub中的MBProgressHUD ♀️,我们的项目汇总因为用到了MBProgressHUD框架,所以只能是用UIViewController上布局一个UITableView来实现,这样我们再self.view上布局MBProgressHUD
#import "ViewController.h" #import <MBProgressHUD.h> @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [MBProgressHUD showHUDAddedTo:
HUD与吐司 MBProgressHUD - 最多人用的loading。 EBuyCommon - 1.基于MBProgressHUD实现得图形加载提示方式,及其标题方式提醒.2。弹窗。