Iphone 显示 “正在加载”
ActivityView.h
#import
#define kAnimationDurationStart 2
#define kAnimationDurationEnd 1
@interface ActivityView : NSObject {
IBOutlet UILabel *messageLabel;
IBOutlet UIView *view;
BOOL isShow;
}
@property (nonatomic, readonly) UILabel *messageLabel;
@property (nonatomic, readonly) UIView *view;
@property (nonatomic) BOOL isShow;
+ (ActivityView *)sharedActivityView;
- (void)showWithMessage:(NSString *)message animate:(BOOL)animate;
- (void)hide:(BOOL)animate;
@end
ActivityView.m
#import "ActivityView.h"
@implementation ActivityView
@synthesize messageLabel,view, isShow;
//单例模式
static ActivityView *activityView;
- (id) init {
self = [super init];
if (self != nil) {
[[NSBundle mainBundle] loadNibNamed:@"ActivityView" owner:self options:nil];
[[[UIApplication sharedApplication] keyWindow] addSubview:view];
[view setFrame:CGRectMake(0, [UIApplication
sharedApplication].statusBarFrame.size.height-view.frame.size.height,
view.frame.size.width, view.frame.size.height)];
isShow = NO;
} return self;
}
+ (ActivityView *)sharedActivityView {
if (!activityView) {
activityView = [[ActivityView alloc]init];
}
return activityView;
}
- (void)showWithMessage:(NSString *)message animate:(BOOL)animate {
isShow = YES;
messageLabel.text = message;
[view.superview bringSubviewToFront:view];
}
http://www.iappex.com/

浙公网安备 33010602011771号