| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // HJLoadingView.m
- // HappyJob
- //
- // Created by Bob on 2019/4/22.
- // Copyright © 2019 Bob. All rights reserved.
- //
- #import "HJLoadingView.h"
- #import "UIImageView+FBRotation.h"
- @interface HJLoadingView ()
- @property (nonatomic, strong) UIImageView *imageView;
- @end
- @implementation HJLoadingView
- - (instancetype)init {
- if (self = [super init]) {
- self.backgroundColor = [UIColor whiteColor];
-
- [self addSubview:self.imageView];
- [self makeConstraints];
-
- // 开始旋转
- [self.imageView fb_startAnimation];
- }
- return self;
- }
- - (void)makeConstraints {
- [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(self);
- make.size.mas_equalTo(self.imageView.frame.size);
- }];
- }
- #pragma mark - getters and setters
- - (UIImageView *)imageView {
- if (_imageView == nil) {
- _imageView = [[UIImageView alloc] init];
- _imageView.image = [UIImage imageNamed:@"loading_image_white"];
- _imageView.contentMode = UIViewContentModeCenter;
- _imageView.backgroundColor = [UIColor colorWithRed:81/255.0 green:145/255.0 blue:211/255.0 alpha:1.0];
- _imageView.frame = CGRectMake(0, 0, 62, 62);
- _imageView.layer.cornerRadius = 31;
- _imageView.layer.masksToBounds = YES;
- }
- return _imageView;
- }
- @end
|