How to use activity indicator view on iPhone?

后端 未结 8 1150
太阳男子
太阳男子 2020-11-29 16:14

An activity indicator view is useful in many applications. Any ideas about how to add, activiate and dismiss an activity indicator view on iPhone?

All the methods fo

8条回答
  •  一生所求
    2020-11-29 16:45

    Using Storyboard-

    Create-

    • Go to main.storyboard (This can be found in theProject Navigator on the left hand side of your Xcode) and drag and drop the "Activity Indicator View" from the Object Library.

    Activity Indicator View from Object Library

    • Go to the header file and create an IBOutlet for the UIActivityIndicatorView-

       @interface ViewController : UIViewController
      
           @property (nonatomic,strong) IBOutlet UIActivityIndicatorView *activityIndicatorView;
      
       @end
      
    • Establish the connection from the Outlets to the UIActivityIndicatorView.

    Start:

    Use the following code when you need to start the activity indicator using following code in your implementation file(.m)-

     [self.activityIndicatorView startAnimating];
    

    Stop:

    Use the following code when you need to stop the activity indicator using following code in your implementation file(.m)-

     [self.activityIndicatorView stopAnimating];
    

提交回复
热议问题