Created
May 29, 2019 10:55
-
-
Save magnuskahr/420820979b9ae565281a602f22cc2296 to your computer and use it in GitHub Desktop.
Showing an ActivityIndicator in a Alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alert = UIAlertController(title: "Sender ...", message: nil, preferredStyle: .alert) | |
let activityIndicator = UIActivityIndicatorView(style: .gray) | |
activityIndicator.translatesAutoresizingMaskIntoConstraints = false | |
activityIndicator.isUserInteractionEnabled = false | |
activityIndicator.startAnimating() | |
alert.view.addSubview(activityIndicator) | |
alert.view.heightAnchor.constraint(equalToConstant: 95).isActive = true | |
activityIndicator.centerXAnchor.constraint(equalTo: alert.view.centerXAnchor, constant: 0).isActive = true | |
activityIndicator.bottomAnchor.constraint(equalTo: alert.view.bottomAnchor, constant: -20).isActive = true | |
present(alert, animated: true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment