Step 1 -
Add 2 buttons to the main view and Give them a title of start and stop.
Step 2 -
Add Activity Indicator to the center of the view.
Select the Activity Indicator and go to the Attributes Inspector.
Give the Activity Indicator a style of Large
White and a color if yellow. select the "Hides when stopped" option.
Step 3 -
Create Outlet in ViewController.m. and IBAction Method
ViewController.m
Add 2 buttons to the main view and Give them a title of start and stop.
Step 2 -
Add Activity Indicator to the center of the view.
Select the Activity Indicator and go to the Attributes Inspector.
Give the Activity Indicator a style of Large
White and a color if yellow. select the "Hides when stopped" option.
Step 3 -
Create Outlet in ViewController.m. and IBAction Method
ViewController.m
@interface ViewController () @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicatorView; - (IBAction)startSpinning:(UIButton *)sender; - (IBAction)stopSpinning:(UIButton *)sender; @end
Implementing created method
- (IBAction)startSpinning:(UIButton *)sender {
[self.activityIndicatorView startAnimating];
}
- (IBAction)stopSpinning:(UIButton *)sender {
[self.activityIndicatorView stopAnimating];
}