【发布时间】:2020-08-06 01:00:18
【问题描述】:
在标题中添加 SF 符号时遇到问题。 SF Symbols 与标题文本重叠有人可以帮我吗
func uialert(){
let alert = UIAlertController(title: "New User Created", message: " A new user has been created.", preferredStyle: .alert)
let imgTitle = UIImage(systemName: "checkmark.circle")
let imgViewTitle = UIImageView(frame: CGRect(x: 120, y: 10, width: 30, height: 30))
imgViewTitle.image = imgTitle
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
alert.view.addSubview(imgViewTitle)
self.present(alert, animated: true)
}
【问题讨论】:
-
不支持将您自己的视图添加到警报控制器的视图中。来自docs:“此类的视图层次结构是私有的,不得修改。”
-
我可以在标题中添加图片吗?
标签: swift ios13 uialertcontroller sf-symbols