-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
292 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// | ||
// MBProgressHUD+MP.h | ||
// MobileProject | ||
// 当引入MBProgressHUD时把下面的代码开放出来 | ||
// 使用如下: | ||
// [MBProgressHUD showIconMessage:@"默认图,X秒后自动消失" ToView:self.view RemainTime:3]; | ||
// [MBProgressHUD showMessage:@"纯文字,不自动消失" ToView:self.view]; 关掉则用:[MBProgressHUD hideHUD];//使用此方法进行隐藏 | ||
// MBProgressHUD *hud = [MBProgressHUD showProgressToView:nil ProgressModel:MBProgressHUDModeDeterminate Text:@"loading"]; 隐藏:[hud hide:YES]; | ||
// [MBProgressHUD showAutoMessage:@"自动消失"]; | ||
// [MBProgressHUD showSuccess:@"下载完成" ToView:self.view]; | ||
// [MBProgressHUD showError:@"下载失败" ToView:self.view]; | ||
// Created by wujunyang on 16/7/9. | ||
// Copyright © 2016年 wujunyang. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
//#import "MBProgressHUD.h" | ||
// | ||
//@interface MBProgressHUD (MP) | ||
// | ||
// | ||
///** | ||
// * 自定义图片的提示,1s后自动消息 | ||
// * | ||
// * @param text 要显示的文字 | ||
// * @param icon 图片地址(建议不要太大的图片) | ||
// * @param view 要添加的view | ||
// */ | ||
//+ (void)showCustomIcon:(NSString *)iconName Title:(NSString *)title ToView:(UIView *)view; | ||
// | ||
// | ||
///** | ||
// * 自动消失成功提示,带默认图 | ||
// * | ||
// * @param success 要显示的文字 | ||
// * @param view 要添加的view | ||
// */ | ||
//+ (void)showSuccess:(NSString *)success ToView:(UIView *)view; | ||
// | ||
// | ||
///** | ||
// * 自动消失错误提示,带默认图 | ||
// * | ||
// * @param error 要显示的错误文字 | ||
// * @param view 要添加的View | ||
// */ | ||
//+ (void)showError:(NSString *)error ToView:(UIView *)view; | ||
// | ||
// | ||
///** | ||
// * 文字+菊花提示,不自动消失 | ||
// * | ||
// * @param message 要显示的文字 | ||
// * @param view 要添加的View | ||
// * | ||
// * @return MBProgressHUD | ||
// */ | ||
//+ (MBProgressHUD *)showMessage:(NSString *)message ToView:(UIView *)view; | ||
// | ||
// | ||
///** | ||
// * 快速显示一条提示信息 | ||
// * | ||
// * @param showAutoMessage 要显示的文字 | ||
// */ | ||
//+ (void)showAutoMessage:(NSString *)message; | ||
// | ||
// | ||
///** | ||
// * 自动消失提示,无图 | ||
// * | ||
// * @param message 要显示的文字 | ||
// * @param view 要添加的View | ||
// */ | ||
//+ (void)showAutoMessage:(NSString *)message ToView:(UIView *)view; | ||
// | ||
// | ||
///** | ||
// * 自定义停留时间,有图 | ||
// * | ||
// * @param message 要显示的文字 | ||
// * @param view 要添加的View | ||
// * @param time 停留时间 | ||
// */ | ||
//+(void)showIconMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time; | ||
// | ||
// | ||
///** | ||
// * 自定义停留时间,无图 | ||
// * | ||
// * @param text 要显示的文字 | ||
// * @param view 要添加的View | ||
// * @param time 停留时间 | ||
// */ | ||
//+(void)showMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time; | ||
// | ||
// | ||
///** | ||
// * 加载视图 | ||
// * | ||
// * @param view 要添加的View | ||
// */ | ||
//+ (void)showLoadToView:(UIView *)view; | ||
// | ||
// | ||
///** | ||
// * 进度条View | ||
// * | ||
// * @param view 要添加的View | ||
// * @param model 进度条的样式 | ||
// * @param text 显示的文字 | ||
// * | ||
// * @return 返回使用 | ||
// */ | ||
//+ (MBProgressHUD *)showProgressToView:(UIView *)view ProgressModel:(MBProgressHUDMode)model Text:(NSString *)text; | ||
// | ||
// | ||
///** | ||
// * 隐藏ProgressView | ||
// * | ||
// * @param view superView | ||
// */ | ||
//+ (void)hideHUDForView:(UIView *)view; | ||
// | ||
// | ||
///** | ||
// * 快速从window中隐藏ProgressView | ||
// */ | ||
//+ (void)hideHUD; | ||
// | ||
//@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// | ||
// NSObject+MP.m | ||
// MobileProject | ||
// | ||
// Created by wujunyang on 16/7/9. | ||
// Copyright © 2016年 wujunyang. All rights reserved. | ||
// | ||
|
||
#import "MBProgressHUD+MP.h" | ||
|
||
//@implementation MBProgressHUD (MP) | ||
// | ||
//#pragma mark 显示错误信息 | ||
//+ (void)showError:(NSString *)error ToView:(UIView *)view{ | ||
// [self showCustomIcon:@"error.png" Title:error ToView:view]; | ||
//} | ||
// | ||
//+ (void)showSuccess:(NSString *)success ToView:(UIView *)view | ||
//{ | ||
// [self showCustomIcon:@"success.png" Title:success ToView:view]; | ||
//} | ||
// | ||
//#pragma mark 显示一些信息 | ||
//+ (MBProgressHUD *)showMessage:(NSString *)message ToView:(UIView *)view { | ||
// if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; | ||
// // 快速显示一个提示信息 | ||
// MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; | ||
// hud.labelText = message; | ||
// // 隐藏时候从父控件中移除 | ||
// hud.removeFromSuperViewOnHide = YES; | ||
// // YES代表需要蒙版效果 | ||
// hud.dimBackground = YES; | ||
// return hud; | ||
//} | ||
// | ||
////加载视图 | ||
//+(void)showLoadToView:(UIView *)view{ | ||
// [self showMessage:@"Loading..." ToView:view]; | ||
//} | ||
// | ||
// | ||
///** | ||
// * 进度条View | ||
// */ | ||
//+ (MBProgressHUD *)showProgressToView:(UIView *)view ProgressModel:(MBProgressHUDMode)model Text:(NSString *)text{ | ||
// if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; | ||
// MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; | ||
// hud.mode = model; | ||
// hud.labelText = text; | ||
// return hud; | ||
//} | ||
// | ||
// | ||
////快速显示一条提示信息 | ||
//+ (void)showAutoMessage:(NSString *)message{ | ||
// | ||
// [self showAutoMessage:message ToView:nil]; | ||
//} | ||
// | ||
// | ||
////自动消失提示,无图 | ||
//+ (void)showAutoMessage:(NSString *)message ToView:(UIView *)view{ | ||
// [self showMessage:message ToView:view RemainTime:0.9 Model:MBProgressHUDModeText]; | ||
//} | ||
// | ||
////自定义停留时间,有图 | ||
//+(void)showIconMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time{ | ||
// [self showMessage:message ToView:view RemainTime:time Model:MBProgressHUDModeIndeterminate]; | ||
//} | ||
// | ||
////自定义停留时间,无图 | ||
//+(void)showMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time{ | ||
// [self showMessage:message ToView:view RemainTime:time Model:MBProgressHUDModeText]; | ||
//} | ||
// | ||
//+(void)showMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time Model:(MBProgressHUDMode)model{ | ||
// | ||
// if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; | ||
// // 快速显示一个提示信息 | ||
// MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; | ||
// hud.labelText = message; | ||
// //模式 | ||
// hud.mode = model; | ||
// // 隐藏时候从父控件中移除 | ||
// hud.removeFromSuperViewOnHide = YES; | ||
// // YES代表需要蒙版效果 | ||
// hud.dimBackground = YES; | ||
// // 隐藏时候从父控件中移除 | ||
// hud.removeFromSuperViewOnHide = YES; | ||
// // X秒之后再消失 | ||
// [hud hide:YES afterDelay:time]; | ||
//} | ||
// | ||
//+ (void)showCustomIcon:(NSString *)iconName Title:(NSString *)title ToView:(UIView *)view | ||
//{ | ||
// if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; | ||
// // 快速显示一个提示信息 | ||
// MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; | ||
// hud.labelText = title; | ||
// // 设置图片 | ||
// if ([iconName isEqualToString:@"error.png"] || [iconName isEqualToString:@"success.png"]) { | ||
// hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"MBProgressHUD.bundle/%@", iconName]]]; | ||
// }else{ | ||
// hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:iconName]]; | ||
// } | ||
// // 再设置模式 | ||
// hud.mode = MBProgressHUDModeCustomView; | ||
// | ||
// // 隐藏时候从父控件中移除 | ||
// hud.removeFromSuperViewOnHide = YES; | ||
// | ||
// // 1秒之后再消失 | ||
// [hud hide:YES afterDelay:0.9]; | ||
//} | ||
// | ||
//+ (void)hideHUDForView:(UIView *)view | ||
//{ | ||
// if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; | ||
// [self hideHUDForView:view animated:YES]; | ||
//} | ||
// | ||
//+ (void)hideHUD | ||
//{ | ||
// [self hideHUDForView:nil]; | ||
//} | ||
// | ||
// | ||
//@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters