【发布时间】:2021-11-22 10:04:47
【问题描述】:
将 UIKit 元素连接到我的故事板时发生崩溃。
错误代码:
Exception NSException * "[<UIViewController 0x7f818646dd30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key labelProva." 0x0000600002ed0c60
这是视图的代码:
import UIKit
class WelcomeViewController: UIViewController {
@IBOutlet weak var labelProva: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
title = K.nomeApp
labelProva.text = "Buongiorno e benvenuto su MPB"
labelProva.text = K.App_Text.tutorialApp
}
}
视图信息的各种截图:
【问题讨论】:
-
您是否将有问题的视图控制器设置为您想要的类?
-
通过在情节提要中选择您的标签并单击显示连接检查器来发送屏幕截图
-
@valeCocoa 如果您的意思是尝试将其设置为“UITableViewController”而不是“UIViewController”,是的,我做到了,但不幸的是它没有用。
-
@Gowtham 我按要求添加了截图。
-
不,您应该将情节提要中的违规视图控制器设置为与您的子类
WelcomeViewController相同的类型。