旋转进度条 WaitView



WaitView.h


#import <Foundation/Foundation.h>

@interface WaitView : NSObject

+ (UIView*)CreateWaitView:(NSString *)waitInfo tag:(NSInteger)tag;

@end


WaitView.m



#import "WaitView.h"

@implementation WaitView

+ (UIView*)CreateWaitView:(NSString *)waitInfo tag:(NSInteger)tag

{

    CGRect waitViewRect = CGRectMake(80, 180-64, 160, 120);//368

    UIView *waitView = [[UIView alloc] initWithFrame:waitViewRect];

    waitView.backgroundColor = [UIColor clearColor];

    CGRect bgImageRect = CGRectZero;

    bgImageRect.size = waitViewRect.size;

    UIImageView *bgImageView = [[UIImageView alloc] initWithFrame:bgImageRect];

    bgImageView.image = [UIImage imageNamed:@"waitBg.png"];

    [bgImageView setAlpha:0.8];

    [waitView addSubview:bgImageView];

    

    CGRect activityViewRect = CGRectMake(55, 25, 50, 50);

    UIActivityIndicatorView *activityView= [[UIActivityIndicatorView alloc] initWithFrame:activityViewRect];

    activityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;

    [waitView addSubview:activityView];

    

    CGRect labelRect = activityViewRect;

    labelRect.origin.y = activityViewRect.origin.y + activityViewRect.size.height;

    labelRect.origin.x = 0;

    labelRect.size.height = 30;

    labelRect.size.width = waitViewRect.size.width;

    UILabel *label = [[UILabel alloc] initWithFrame:labelRect];

    label.backgroundColor = [UIColor clearColor];

    label.textColor = [UIColor whiteColor];

    label.text = waitInfo;

    label.font = [UIFont systemFontOfSize:14.0];

    label.textAlignment = NSTextAlignmentCenter;

    [waitView addSubview:label];

    

    [activityView startAnimating];

    [waitView setTag:tag];

    return waitView;

}

@end


下面的是其中背景图片的素材。




使用的时候在你想调用的地方:


UIView*waitView=[WaitView CreateWaitView:@"正在努力加载....." tag:100];

 [self.view addSubview:waitView];


不要忘记导入 :  


#import "WaitView.h"




//****************************************************和上面无关。

- (void)showWaitView:(NSString*)info;

- (void)dismissWaitView;


- (void)showWaitView:(NSString*)info

{

    UIView *waitView = [WaitView CreateWaitView:info tag:(EFAMILYNUMTAG*2)];

    [self.view addSubview:waitView];

    self.view.userInteractionEnabled = NO;

}


- (void)dismissWaitView

{

    [[self.view viewWithTag:(EFAMILYNUMTAG*2)] removeFromSuperview];

    self.view.userInteractionEnabled = YES;

}





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值