.h file
@interface RootViewController : UIViewController {
@property (nonatomic, retain) UIActivityIndicatorView * activityView;
@interface RootViewController : UIViewController {
UIActivityIndicatorView *activityView;UIView *loadingView;UILabel *loadingLabel;}@property (nonatomic, retain) UIActivityIndicatorView * activityView;
@property (nonatomic, retain) UIView *loadingView;
@property (nonatomic, retain) UILabel *loadingLabel;
.m file
#import <QuartzCore/QuartzCore.h>
@synthesize activityView;
@synthesize loadingView;
@synthesize loadingLabel;
loadingView = [[UIView alloc] initWithFrame:CGRectMake(x, y, width, height)];
loadingView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
loadingView.clipsToBounds = YES;
loadingView.layer.cornerRadius = 10.0;
activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityView.frame = CGRectMake(65, 40, activityView.bounds.size.width, activityView.bounds.size.height);
[loadingView addSubview:activityView];
loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
loadingLabel.backgroundColor = [UIColor clearColor];
loadingLabel.textColor = [UIColor whiteColor];
loadingLabel.adjustsFontSizeToFitWidth = YES;
loadingLabel.textAlignment = UITextAlignmentCenter;
loadingLabel.text = @"Loading...";
[loadingView addSubview:loadingLabel];
[self.view addSubview:loadingView];
[activityView startAnimating];
[activityView stopAnimating];
[loadingView removeFromSuperview];
No comments:
Post a Comment