I\'ve created a UIAlertView that contains a UIActivityIndicator. Everything works great, but I\'d also like the UIAlertView to disappear after 5 seconds.
Ho
in swift 2 you can do this. Credit to @Lyndsey Scott
let alertController = UIAlertController(title: "youTitle", message: "YourMessage", preferredStyle: .Alert)
self.presentViewController(alertController, animated: true, completion: nil)
let delay = 5.0 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue(), {
alertController.dismissViewControllerAnimated(true, completion: nil)
})