Answer the question
In order to leave comments, you need to log in
Display UIAlertController and hide it programmatically, how?
Guys, how to display UIAlertController and hide it on request?
I want to just block the screen while the data is loading, for example, in a tableview and show an alert with the text "loading" for this time. I
show it like this:
https://yadi.sk/i/JFsuR9FmoeftN
Code:
func showIndicator() -> UIAlertController {
let pending = UIAlertController(title: "Загрузка...", message: nil, preferredStyle: .Alert)
self.presentViewController(pending, animated: true, completion: nil)
return pending
}
showIndicator()
self.dismissViewControllerAnimated(false, completion: nil)
Answer the question
In order to leave comments, you need to log in
You need to remember the displayed alert (pending which is preferably weak) and where you will close the
pending?.presentingViewController?. dismiss... And so on. Usually this is done in some kind of alert manager, router, or whatever.
Another option is to look for ready-made solutions (yes, yes, they are). And then an alert with the inscription loading, somehow this is wrong ...
Here is the first one that came prettier
https://github.com/jasperblues/ICLoader
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question