//
// MBProgressHUD.h
// Version 0.4
// Created by Matej Bukovinski on 2.4.09.
//
// This code is distributed under the terms and conditions of the MIT license.
// Copyright (c) 2009 Matej Bukovinski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
/////////////////////////////////////////////////////////////////////////////////////////////
typedef enum {
/** Progress is shown using an UIActivityIndicatorView. This is the default. */
MBProgressHUDModeIndeterminate,
/** Progress is shown using a MBRoundProgressView. */
MBProgressHUDModeDeterminate,
/** Shows a custom view */
MBProgressHUDModeCustomView
} MBProgressHUDMode;
typedef enum {
/** Opacity animation */
MBProgressHUDAnimationFade,
/** Opacity + scale animation */
MBProgressHUDAnimationZoom
} MBProgressHUDAnimation;
/////////////////////////////////////////////////////////////////////////////////////////////
@class MBProgressHUD;
@protocol MBProgressHUDDelegate <NSObject>
@required
/**
* A callback function that is called after the HUD was fully hidden from the screen.
*/
- (void)hudWasHidden:(MBProgressHUD *)hud;
@end
/////////////////////////////////////////////////////////////////////////////////////////////
/**
* A progress view for showing definite progress by filling up a circle (similar to the indicator for building in xcode).
*/
@interface MBRoundProgressView : UIProgressView {}
/**
* Create a 37 by 37 pixel indicator.
* This is the same size as used by the larger UIActivityIndicatorView.
*/
- (id)initWithDefaultSize;
@end
/////////////////////////////////////////////////////////////////////////////////////////////
/**
* Displays a simple HUD window containing a progress indicator and two optional labels for short messages.
*
* This is a simple drop-in class for displaying a progress HUD view similar to Apples private UIProgressHUD class.
* The MBProgressHUD window spans over the entire space given to it by the initWithFrame constructor and catches all
* user input on this region, thereby preventing the user operations on components below the view. The HUD itself is
* drawn centered as a rounded semi-transparent view witch resizes depending on the user specified content.
*
* This view supports three modes of operation:
* - MBProgressHUDModeIndeterminate - shows a UIActivityIndicatorView
* - MBProgressHUDModeDeterminate - shows a custom round progress indicator (MBRoundProgressView)
* - MBProgressHUDModeCustomView - shows an arbitrary, user specified view (@see customView)
*
* All three modes can have optional labels assigned:
* - If the labelText property is set and non-empty then a label containing the provided content is placed below the
* indicator view.
* - If also the detailsLabelText property is set then another label is placed below the first label.
*/
@interface MBProgressHUD : UIView {
MBProgressHUDMode mode;
MBProgressHUDAnimation animationType;
SEL methodForExecution;
id targetForExecution;
id objectForExecution;
BOOL useAnimation;
float yOffset;
float xOffset;
float width;
float height;
BOOL taskInProgress;
float graceTime;
float minShowTime;
NSTimer *graceTimer;
NSTimer *minShowTimer;
NSDate *showStarted;
UIView *indicator;
UILabel *label;
UILabel *detailsLabel;
float progress;
id<MBProgressHUDDelegate> delegate;
NSString *labelText;
NSString *detailsLabelText;
float opacity;
UIFont *labelFont;
UIFont *detailsLabelFont;
BOOL isFinished;
BOOL removeFromSuperViewOnHide;
UIView *customView;
CGAffineTransform rotationTransform;
}
/**
* Creates a new hud, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:.
*
* @param view The view that the HUD will be added to
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
* @return A reference to the created HUD.
*
* @see hideHUDForView:animated:
*/
+ (MBProgressHUD *)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
/**
* Finds a HUD sibview and hides it. The counterpart to this method is showHUDAddedTo:animated:.
*
* @param view The view that is going to be searched for a HUD subview.
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
* @return YES if a HUD was found and removed, NO otherwise.
*
* @see hideHUDForView:animated:
*/
+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
/**
* A convenience constructor that initializes the HUD with the window's bounds. Calls the designated constructor with
* window.bounds as the parameter.
*
* @param window The window instance that will provide the bounds for the HUD. Should probably be the same instance as
* the HUD's superview (i.e., the window that the HUD will be added to).
*/
- (id)initWithWindow:(UIWindow *)window;
/**
* A convenience constructor that initializes the HUD with the view's bounds. Calls the designated constructor with
* view.bounds as the parameter
*
* @param view The view instance that will provide the bounds for the HUD. Should probably be the same instance as
* the HUD's superview (i.e., the view that the HUD will be added to).
*/
- (id)initWithView:(UIView *)view;
/**
* The UIView (i.g., a UIIMageView) to be shown when the HUD is in MBProgressHUDModeCustomView.
* For best results use a 37 by 37 pixel view (so the bounds match the build in indicator bounds).
*/
@property (retain) UIView *customView;
/**
* MBProgressHUD operation mode. Switches between indeterminate (MBProgressHUDModeIndeterminate) and determinate
* progress (MBProgressHUDModeDeterminate). The default is MBProgressHUDModeIndeterminate.
*
* @see MBProgressHUDMode
*/
@property (assign) MBProgressHUDMode mode;
/**
* The animation type that should be used when the HUD is shown and hidden.
*
* @see MBProgressHUDAnimation
*/
@property (assign) MBProgressHUDAnimation animationType;
/**
* The HUD delegate object. If set the delegate will receive hudWasHidden callbacks when the HUD was hidden. The
* delegate should conform to the MBProgressHUDDelegate protocol and implement the hudWasHidden method. The delegate
* object will not be retained.
*/
@property (assign) id<MBProgressHUDDelegate> delegate;
/**
* An optional short message to be displayed below the activity indicator. The HUD is automatically resized to fit
* the entire text. If the text is too long it will get clipped by displaying "..." at the end. If left unchanged or
* set to @"", then no message is displayed.
*/
@property (copy) NSString *labelText;
/**
* An optional details message displayed below the labelText message. This message is displayed only if the labelText
* property is also set and is different from an empty string (@"").
*/
@pr
没有合适的资源?快使用搜索试试~ 我知道了~
MBProgressHUD加载等待类文件
共2个文件
h:1个
m:1个
5星 · 超过95%的资源 需积分: 9 82 下载量 112 浏览量
2011-08-06
18:06:35
上传
评论
收藏 10KB ZIP 举报
温馨提示
该类文件实现了iphone的加载等待效果,与苹果官方sdk的api中的UIActivityIndicatorView类相比,用户体验更好
资源推荐
资源详情
资源评论
收起资源包目录
MBProgressHUD.zip (2个子文件)
MBProgressHUD
MBProgressHUD.h 11KB
MBProgressHUD.m 20KB
共 2 条
- 1
iJecky
- 粉丝: 754
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页