利用UIBezierPath绘制加载动画哦

//  Created by mac on 16/12/23.
//  Copyright © 2016年 zhangjian. All rights reserved.
//
// http://blog.sina.com.cn/resoftios
#import

@interface ZJProgressHUD : UIView

@property (nonatomic , copy) NSString *tipText;

@property (nonatomic , strong) UIColor *toastColor;

@property (nonatomic , strong) UIColor *contentColor;

@property (nonatomic , assign) BOOL showMask;

- (void)show:(BOOL)animated;

- (void)hide:(BOOL)animated;


+ (instancetype)showHUDto:(UIView *)view animated:(BOOL)animated;

+ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated;
// http://blog.sina.com.cn/resoftios
@end


//  Created by mac on 16/12/23.
//  Copyright © 2016年 zhangjian. All rights reserved.
//
#import "ZJProgressHUD.h"
#import

#define SIZE_RADIUS_WIDTH 12
#define SIZE_FONT_TIP 12

#define TIP_DEFULT_TEXT  @"Loading..."

#define KEY_ANIMATION_ROTATE @"KEY_ANIMATION_ROTATE"
#define KEY_ANIMATION_TEXT @"KEY_ANIMATION_TEXT"

@interface ZJProgressHUD()

@property (nonatomic , strong) UIView *toast;

@property (nonatomic , strong) UIView *rotateView;

@property (nonatomic , strong) CAShapeLayer *rotateLayer;

@property (nonatomic , strong) CAShapeLayer *textLayer;
@end

@implementation ZJProgressHUD

+ (instancetype)showHUDto:(UIView *)view animated:(BOOL)animated
{
      ZJProgressHUD *hud = [[self alloc] initWithView:view];
      [view addSubview:hud];
      [hud show:animated];
      return hud;
}

+ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated
{
      NSMutableArray *huds = [NSMutableArray array];
      NSArray *subviews = view.subviews;
      for (UIView *aView in subviews)
      {
              if ([aView isKindOfClass:[ZJProgressHUD class]])
              {
                      [huds addObject:aView];
              }
      }
     
      for (ZJProgressHUD *hud in huds)
      {
              [hud hide:animated];
      }
      return [huds count];
}

- (void)dealloc
{
     
}

static CGFloat toastWidth = 80;
- (instancetype)initWithFrame:(CGRect)frame
{
      self = [super initWithFrame:frame];
      if (self)
      {
              self.tipText = TIP_DEFULT_TEXT;
             
              _toast = [[UIView alloc] initWithFrame:CGRectMake((self.frame.size.width - toastWidth) / 2, (self.fram
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值