본문 바로가기
ios 뽀개기/objective-c

ios 인디케이터

by 인생여희 2019. 10. 24.
반응형

.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;   

}

반응형

댓글