IOS TOPICS

IOS Introduction
Swift UI Label
Swift UI Button
Swift UI Text Field
Swift UI Slider
Swift UI Switch
Swift UI Stepper
Swift UI Date Picker
Swift UI Segmented Control
Views
Table View
Collection Views
SCROLL VIEW
iOS Content View
iOS View Controllers
iOS Bar interface
iOS Navigation interface
iOS Architect Pattern
iOS Libraries
iOS Web request and parsing
iOS user defaults
iOS Coredata and database

Activity Indicator View


Activity Indicator View

An ActivityIndicator is a type of content view that may be used to display the status of a task, and it's mostly utilized for intra-network communications. Methods defined in the UIActivityIndicatorView class may be used to manipulate the ActivityIndicator View, and UIActivityIndicatorView is a UIView subclass.

  1. class UIActivityIndicatorView : UIView
    The animation may be started using the UIActivityIndicatorView class's startAnimating() function. Stopping the animation may also be done with the stopAnimating() function. In the iOS application, the two techniques are combined to show and conceal the activity indicator.

Adding UIActivityIndicatorView to interface

  1. In the object library, look for UIActivityIndicatorView and drag it to the storyboard.
  2. Define the Auto Layout rules to control the size and placement of the activity indicator on devices of various sizes.
  3. Create an ActivityIndicator action outlet in the ViewController class.
  4. Using the methods and attributes described in the UIActivityIndicatorView class to start and stop the animation.
  5. activityIndicator is a new private method. As previously stated, this technique requires three parameters. For some flexibility, all of the options have a default value. Because there are only two possibilities for style,.large or.medium, I've chosen.medium as the default. Finally, we have a central argument, which allows us to establish a frame if we want to. We'll be able to pass a center point for our activity indicator due to this. You'll have to manually compute the center point based on the size of the frame if you utilize the center and frame combined.
  6. With style provided as input, we create a UIActivityIndicatorView.

We'll set the activityIndicatorView frame if we have one.
We will set the center of our activityIndicatorView if we have a center point, and the activity indication should be returned.
All left to do now is execute this method and add the activity view as a subview. This is something I'm going to perform in my viewDidLoad function.