【发布时间】:2023-04-04 14:56:01
【问题描述】:
抱歉标题混淆了,我不知道如何使它更有意义。
我正在使用这个例子实现信息窗口:github
我在 popView 中添加了一些标签并将它们链接到 secondaryVieController。
我已将 PrimaryViewController 中的 prepareForSegue 方法修改为:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showInfo" {
let info = segue.destinationViewController as! SecondaryViewController
info.adrLabel.text = branch.address
info.nameLabel.text = branch.name
info.telLabel.text = branch.tel
dim(.In, alpha: dimLevel, speed: dimSpeed)
}
}
但是当我运行它时,我收到错误“致命错误:在展开可选值时意外发现 nil”
这是因为 info.popupView 为 nil。
但是你能解释一下我应该如何设置它吗?以及如果没有任何附加标签,为什么它可以正常工作。
谢谢。
【问题讨论】:
标签: ios swift class user-interface uiviewcontroller