[英]Connect ViewController to .swift file in XCode
As you can see in the image below, my View Controller (a Table view controller if that matters) is named "BasicPhrasesVC" and my .swift file is also named "BasicPhrasesVC". 如下图所示,我的View Controller(表视图控制器,如果重要)被命名为“BasicPhrasesVC”,我的.swift文件也被命名为“BasicPhrasesVC”。 Despite this the error "Unknown class BasicPhrasesVC in Interface Builder file."
尽管如此,错误“ Interface Builder文件中的未知类BasicPhrasesVC”。 keeps appearing.
不断出现。 I also did not rename them if it helps.
如果有帮助,我也没有重命名它们。
Thanks for any help in advance. 在此先感谢您的帮助。
in your BasicPhrasesVC.swift, the code should be something like this 在你的BasicPhrasesVC.swift中,代码应该是这样的
class BasicPhrasesVC {
....
}
the Class in your Interface builder should be the same as the class same in your file, it doesn't matter where you place your class. “ 界面”构建器中的“ 类”应与文件中的类相同 ,无论您在何处放置类都无关紧要。 At last, after you fix your class name, in your interface builder Custom Class -> Class, input the correct name and " press Enter "
最后,在修改类名后,在界面构建器Custom Class - > Class中输入正确的名称并“ 按Enter键 ”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.