gpt4 book ai didi

ios - UIImage 与 UIAlertController 中的 UITextField 重叠

转载 作者:行者123 更新时间:2023-11-30 12:32:51 28 4
gpt4 key购买 nike

我的代码是这样的:

let alert = UIAlertController(title: "title", message: "alert", preferredStyle: UIAlertControllerStyle.Alert)
let image_view = UIImageView(frame: CGRectMake(70, 10, 200, 200))
image_view.image = UIImage(named: "logo")
alert.view.addSubview(image_view)
alert.addTextFieldWithConfigurationHandler { textField in textField.placeholder = "a textfield"
alert.addTextFieldWithConfigurationHandler { textField in textField.placeholder = "another textfield" }

但这会导致我的 Logo 与 UITextFields 重叠。我怎样才能确保它们整齐地堆叠在一起?

最佳答案

从我的角度来看,如果您想使用自定义 UI 创建 UIAlertController ,请尝试自己创建它。或者,如果您想使用像这样有点hacky的解决方案:

let image = UIImage(named: "logo")
alert.setValue(image, forKey: "image")

关于ios - UIImage 与 UIAlertController 中的 UITextField 重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43274617/

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