AppDelegate Swift 中的 UITableView 编译错误



这是我的视图控制器:

import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    let list = ["Facebook: 2000$", "Twitter: 10000$", "Vine: 23356$", "Uber: 35000", "Adobe Systems: 400900", "Agilent Tech: 456700", "Ebay: 98899"]
    public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
    {
        return (list.count)
    }
    public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "cell")
        cell.textLabel?.text = list[indexPath.row]
        return(cell)
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}

和我的应用委托:

import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }
    func applicationWillResignActive(_ application: UIApplication) { etc..

我做错了什么?

它可能

丢失-

override func viewDidLoad() {
    super.viewDidLoad()
    yourTableView.delegate = self
    yourTableView.dataSource = self
}

最新更新