mvm_core_ui/MVMCoreUI/BaseControllers/MFLoadingViewController.m
Pfeil, Scott Robert 98fa47aaae Migration
2019-01-10 14:23:14 -05:00

68 lines
2.3 KiB
Objective-C

//
// MFLoadingViewController.m
// myverizon
//
// Created by Scott Pfeil on 11/20/14.
// Copyright (c) 2014 Verizon Wireless. All rights reserved.
//
#import "MFLoadingViewController.h"
#import "MFLoadingSpinner.h"
#import "NSLayoutConstraint+MVMCoreUIConvenience.h"
#import "UIColor+MVMCoreUIConvenience.h"
#import "MFStyler.h"
#import "MVMCoreUICommonViewsUtility.h"
@interface MFLoadingViewController ()
@property (nullable, weak, nonatomic) MFLoadingSpinner *activityIndicator;
@property (nullable, weak, nonatomic) UIView *transparentBackgroundView;
@end
@implementation MFLoadingViewController
- (void)loadView {
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
view.backgroundColor = [UIColor clearColor];
self.view = view;
// Sets up the loading view.
MFLoadingSpinner *activityIndicatorView = [[MFLoadingSpinner alloc] initWithFrame:CGRectMake(0, 0, 36, 36)];
activityIndicatorView.backgroundColor = [UIColor clearColor];
activityIndicatorView.translatesAutoresizingMaskIntoConstraints = NO;
[view addSubview:activityIndicatorView];
self.activityIndicator = activityIndicatorView;
[NSLayoutConstraint constraintPinView:activityIndicatorView heightConstraint:YES heightConstant:PaddingSix widthConstraint:YES widthConstant:PaddingSix];
// Sets the constraints for the activityIndicatorView
[NSLayoutConstraint constraintPinSubview:activityIndicatorView pinCenterX:YES pinCenterY:YES];
// Sets up the transparent background view.
UIView *transparentBackground = [MVMCoreUICommonViewsUtility commonView];
transparentBackground.backgroundColor = [UIColor mfBackgroundGray];
transparentBackground.alpha = 0.9;
[view insertSubview:transparentBackground belowSubview:activityIndicatorView];
self.transparentBackgroundView = transparentBackground;
// Sets the constraints of the transparent background view to be the same as the activity indicator view.
[NSLayoutConstraint constraintPinSubviewToSuperview:transparentBackground];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
#pragma mark - LoadingView Functions
- (void)startLoading {
[self.activityIndicator resumeSpinner];
}
- (void)stopLoading {
[self.activityIndicator pauseSpinner];
}
@end