I used to have a "Please wait" dialog in my app for long time. It was quite simple thing using UIActivityIndicatorView
and adding it to UIAlertView
.
However iOS8 introduced UIAlertController
. Is it possible to add anything to it to have similiar effect? Is there another way of doing such thing with iOS8?
I have searched a lot of sites and still have no idea how it can be done with the new API.
I would appreciate any answers - links to libs, tutorials etc., which could be helpful.
Regards,
Mateusz
Same as @pheedsta but changed to work with Swift 4
Usage:
It seems to be impossible to do it plain old way using only basic API. I have decided to use DTAlertView which allows such modifications. It works as I wanted.
https://github.com/Darktt/DTAlertView
If you only want to display title and activity indicator and you feel adventurous, you can hack AlertController's view hierarchy. The code below works on 8.2. However this normally should not be in production.
As it's been noted in comments below, using this code in your app may get you rejected, here is the excerpt from documentation:
Produces something like that:
Try this I done some trick...
Below code is working for me in iPod iOS8beta5 + XCode6
Instead of using a UIAlertController, you can use a custom UIViewController that is presented modally. Here is what I use in Swift 2.0:
You use it like this:
And it will look like this:
Presentation Controller and Animated Transitioning
See this answer for a sample implementation that recreates the
UIAlertController
animation usingUIViewControllerAnimatedTransitioning
.Swift 3.0/4.1
To show the progress dialog:
To dismiss the progress dialog: