ios - Swift 创建自定义警报控制器初始化程序
问题描述
我正在实施 UIAlertController 以在重置用户密码时进行确认。我创建了一个继承自 UIAlertController 的自定义类。我还为我在文档中看到的类进行了初始化。
import UIKit
class PasswordResetConfirmationViewController: UIAlertController {
init() {
super.init(title: "Are you sure you would like to reset your password?",message: "",preferredStyle: .alert)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
奇怪的是我得到这个错误必须在 xcode 中调用超类“UIAlertController”的指定初始化程序。这是来自 UIAlertController 的初始化
init(title: String?,
message: String?,
preferredStyle: UIAlertController.Style)
我不确定是什么在 xcode 中产生了这个错误,任何帮助都会很棒。
解决方案
推荐阅读
- apache-kafka - 如何使用@KafkaListner 注解订阅多个主题
- geopandas - 在 Pyviz/hvplot 中显示 POINT 数据的悬停信息
- excel - 当 S3 发生更改时更新 Excel 中的行
- azure - ARM模板将字符串数组转换为对象数组
- javascript - 具有两个 y 轴的混合图(线/条)不会在第二轴上显示数据
- ios - 更新到 Xcode 10.2、Swift 5 后找不到“NBPhoneNumberDesc.h”文件
- angular - 是否可以对网格列表中的图块进行排序?
- html - 如何创建排斥其他链接的悬停效果?
- python - 通过索引将列从 1 个数据帧添加到另一个链接的正确语法
- unicode - 从 C++ 中的十六进制数字创建 Unicode