@@ -51,6 +51,7 @@ @implementation SCLAlertView
5151CGFloat kCircleBackgroundTopPosition ;
5252CGFloat kCircleHeightBackground ;
5353CGFloat kCircleIconHeight ;
54+ CGFloat kActivityIndicatorHeight ;
5455CGFloat kWindowWidth ;
5556CGFloat kWindowHeight ;
5657CGFloat kTextHeight ;
@@ -85,6 +86,7 @@ - (instancetype)init
8586 kCircleBackgroundTopPosition = -15 .0f ;
8687 kCircleHeightBackground = 62 .0f ;
8788 kCircleIconHeight = 20 .0f ;
89+ kActivityIndicatorHeight = 40 .0f ;
8890 kWindowWidth = 240 .0f ;
8991 kWindowHeight = 178 .0f ;
9092 kSubTitleHeight = 90 .0f ;
@@ -95,7 +97,7 @@ - (instancetype)init
9597 _hideAnimationType = FadeOut;
9698 _showAnimationType = SlideInFromTop;
9799 _backgroundType = Shadow;
98-
100+
99101 // Init
100102 _labelTitle = [[UILabel alloc ] init ];
101103 _viewText = [[UITextView alloc ] init ];
@@ -106,13 +108,15 @@ - (instancetype)init
106108 _backgroundView = [[UIImageView alloc ]initWithFrame:[self mainScreenFrame ]];
107109 _buttons = [[NSMutableArray alloc ] init ];
108110 _inputs = [[NSMutableArray alloc ] init ];
111+ _activityIndicatorView = [[UIActivityIndicatorView alloc ] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge];
109112
110113 // Add Subviews
111114 [self .view addSubview: _contentView];
112115 [self .view addSubview: _circleViewBackground];
113116 [self .view addSubview: _circleView];
114117
115118 [_circleView addSubview: _circleIconImageView];
119+ [_circleView addSubview: _activityIndicatorView];
116120 [_contentView addSubview: _labelTitle];
117121 [_contentView addSubview: _viewText];
118122
@@ -217,6 +221,8 @@ -(void)viewWillLayoutSubviews
217221 _circleView.frame = CGRectMake (kWindowWidth / 2 - kCircleHeight / 2 , kCircleTopPosition , kCircleHeight , kCircleHeight );
218222 _circleView.layer .cornerRadius = self.circleView .frame .size .height / 2 ;
219223 _circleIconImageView.frame = CGRectMake (kCircleHeight / 2 - kCircleIconHeight / 2 , kCircleHeight / 2 - kCircleIconHeight / 2 , kCircleIconHeight , kCircleIconHeight );
224+ _activityIndicatorView.frame =CGRectMake (kCircleHeight / 2 - kActivityIndicatorHeight / 2 , kCircleHeight / 2 - kActivityIndicatorHeight / 2 , kActivityIndicatorHeight , kActivityIndicatorHeight );
225+
220226 _labelTitle.frame = CGRectMake (12 .0f , kCircleHeight / 2 + 12 .0f , kWindowWidth - 24 .0f , 40 .0f );
221227 _viewText.frame = CGRectMake (12 .0f , 74 .0f , kWindowWidth - 24 .0f , kTextHeight );
222228
@@ -515,6 +521,10 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag
515521 iconImage = SCLAlertViewStyleKit.imageOfEdit ;
516522 break ;
517523
524+ case Waiting:
525+ viewColor = UIColorFromRGB (0x6c125d );
526+ break ;
527+
518528 case Custom:
519529 viewColor = color;
520530 iconImage = image;
@@ -596,7 +606,13 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag
596606
597607 // Alert view colour and images
598608 self.circleView .backgroundColor = viewColor;
599- self.circleIconImageView .image = iconImage;
609+
610+ if (style == Waiting) {
611+ [self .activityIndicatorView startAnimating ];
612+ } else {
613+ self.circleIconImageView .image = iconImage;
614+ }
615+
600616
601617 for (UITextField *textField in _inputs)
602618 {
@@ -681,6 +697,11 @@ - (void)showCustom:(UIViewController *)vc image:(UIImage *)image color:(UIColor
681697 [self showTitle: vc image: image color: color title: title subTitle: subTitle duration: duration completeText: closeButtonTitle style: Custom];
682698}
683699
700+ - (void )showWaiting : (UIViewController *)vc title : (NSString *)title subTitle : (NSString *)subTitle closeButtonTitle : (NSString *)closeButtonTitle duration : (NSTimeInterval )duration
701+ {
702+ [self showTitle: vc image: nil color: nil title: title subTitle: subTitle duration: duration completeText: closeButtonTitle style: Waiting];
703+ }
704+
684705#pragma mark - Visibility
685706
686707- (BOOL )isVisible
@@ -790,6 +811,9 @@ - (void)hideView
790811 [self slideOutToRight ];
791812 break ;
792813 }
814+
815+ [_activityIndicatorView stopAnimating ];
816+
793817 if (self.dismissBlock )
794818 {
795819 self.dismissBlock ();
0 commit comments