How do I subclass different view controllers? This is what I've been trying to use:
class secondViewController: UIViewController {
This returns the error "Use of undeclared type UIViewController." What am I doing wrong?
I have started this class in a new .swift file, is that somehow contributing to the problem?
I would greatly appreciate a brief summary of what to do and a link to a GitHub repository that demonstrates how to do this.
如果要对UIKit类进行子类化(或使用),则需要在文件顶部import UIKit
。
The problem I had was that I did not know how to connect my view controller to the class using the navigation panel, and I was importing foundation instead of importing UIKit. See this for more details:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.