Add an animation image per image inside a UIAlertController SWIFT

a 夏天 提交于 2020-01-05 08:47:30

问题


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 UIPresentationControllers.



来源:https://stackoverflow.com/questions/31254931/add-an-animation-image-per-image-inside-a-uialertcontroller-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!