gpt4 book ai didi

image - 快速将图像添加到 UIAlertController

转载 作者:搜寻专家 更新时间:2023-10-31 21:52:42 25 4
gpt4 key购买 nike

我想要一个带有图像的简单 UIAlertController。我该怎么办?

let alertMessage = UIAlertController(title: "Service Unavailable", message: "Please retry later", preferredStyle: .Alert)
alertMessage.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
self.presentViewController(alertMessage, animated: true, completion: nil)

最佳答案

试试这个:

let alertMessage = UIAlertController(title: "Service Unavailable", message: "Please retry later", preferredStyle: .Alert)

let image = UIImage(named: "myImage")
var action = UIAlertAction(title: "OK", style: .Default, handler: nil)
action.setValue(image, forKey: "image")
alertMessage .addAction(action)

self.presentViewController(alertMessage, animated: true, completion: nil)

关于image - 快速将图像添加到 UIAlertController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27578866/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com