0
我曾在变量球员的错误,我发现故障一直未能完成使用未声明的类型“球员”
import UIKit
class PlayersViewController: UITableViewController {
var players:[Player] = playersData
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return players.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
-> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("PlayerCell", forIndexPath: indexPath)
let player = players[indexPath.row] as Player
cell.textLabel?.text = player.name
cell.detailTextLabel?.text = player.game
return cell
}
}
你还没有定义玩家类型。什么是玩家类型应该是什么? – pedrouan