问题描述
我有一个显示UIAlertController的函数。在标题和文本下方,我想为每个图像显示一个动画图像。我有13张图片要循环播放。
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
}
是否可以使用UIAlertController还是我必须完全自定义弹出窗口?
Is it possible to use an UIAlertController or I have to custom completely my pop up?
推荐答案
我不知道这样自定义UIAlertController的方法;它们仅具有三个属性(标题,消息,preferredStyle和textFields),您都不能向其中添加UIImageView。
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.
我建议创建一个自定义的模式表示形式控制器。我实际上只是写了。当然,您将使自定义视图居中,而不是将其固定在右侧,但是该答案至少可以帮助您开始使用 UIPresentationController
s的古怪世界。
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.
这篇关于在UIAlertController SWIFT中为每个图像添加动画图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!