我只是试图在我设置的Smiles数组中显示名称的tableview。我需要将我的单元类“ClubCell”声明为扩展到UITableViewCell,我将如何去做这件事?声明我的CellClass扩展到UITableViewCell?
class SmileClub: UITableViewController {
var Smiles: [String] = ["Price Garrett", "Michael Bishop", "Tom Kollross", "Cody Crawford", "Ethan Bernath", "Alex Mlynarz", "Ryan Murphy", "Kelly Murphy", "Ryan Roshan", "Sean Ko"]
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> ClubCell
{
let cell: ClubCell = tableView.dequeueReusableCellWithIdentifier("ClubCell") as! ClubCell!
cell.Name.text = self.Smiles[indexPath.row] as String
return cell
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.Smiles.count
}
为什么您只是完全改变了您的问题?不要这样做。它将现有的答案留在不好的地方。我只是说你应该在你的问题中添加一行,而不是删除原始问题的详细信息。 – rmaddy
顺便说一句 - 查看我更新的答案。仅供参考 - 如果您不知道如何在Swift中扩展课程,那么您应该回到Swift书籍并研究基础知识以供审阅。 – rmaddy