问题
I have a function to display an UIAlertController. Below the title and the text, I would like to display an animation image per image. I have 13 images to loop.
func alertDownloadInProgress(text:String, sender:UIViewController) -> UIAlertController {
var alert = UIAlertController(title: "Alert", message: text, preferredStyle: UIAlertControllerStyle.Alert)
sender.presentViewController(alert, animated: true, completion: nil)
return alert
}
Is it possible to use an UIAlertController or I have to custom completely my pop up?
回答1:
I don't know of a way to customize a UIAlertController like that; they only have three properties--title, message, preferredStyle, and textFields--none of which you can add a UIImageView to.
I would recommend creating a custom modal presentation controller. I actually just wrote an answer on how to do that. Of course you'll center your custom view instead of pinning it to the right, but that answer could at least help you get started with the wacky world of UIPresentationController
s.
来源:https://stackoverflow.com/questions/31254931/add-an-animation-image-per-image-inside-a-uialertcontroller-swift