.h

//인디케이터 객체 선언

@property (nonatomic, retain) UIActivityIndicatorView *activityIndicator;

 

.m

//인디케이터 시작

-(void)startIndicater{

    NSLog(@"인디케이터 시작");

    // ProgressBar Setting

    _activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];

    [_activityIndicator setCenter:self.view.center];

    [_activityIndicator setColor:UIColor.whiteColor];

    if (@available(iOS 13.0, *)) {

        [_activityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleLarge];

    } else {

        // Fallback on earlier versions

        [_activityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];

    }

    [self.view addSubview : _activityIndicator];

    

    // ProgressBar Start

    _activityIndicator.hidden= FALSE;

    [_activityIndicator startAnimating];

}

 

//인디케이터 종료

-(void)endIndicatter{

    NSLog(@"인디케이터 끝");

    [_activityIndicator stopAnimating];

    _activityIndicator.hidden= TRUE;   

}

+ Recent posts