Xcode中的原型单元是什么?
我想知道xcode中的原型单元是什么? 下面的代码是如何使用开关和原型单元格创建4种不同类型的标签的?我特别想知道开关箱的情况Xcode中的原型单元是什么?,xcode,tableview,prototype,cells,Xcode,Tableview,Prototype,Cells,我想知道xcode中的原型单元是什么? 下面的代码是如何使用开关和原型单元格创建4种不同类型的标签的?我特别想知道开关箱的情况 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forInd
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->
UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
as! DetailTableViewCell
// Configure the cell...
switch indexPath.row {
case 0:
cell.fieldLabel.text = "Name"
cell.valueLabel.text = restaurant.name
case 1:
cell.fieldLabel.text = "Type"
cell.valueLabel.text = restaurant.type
case 2:
cell.fieldLabel.text = "Location"
cell.valueLabel.text = restaurant.location
case 3:
cell.fieldLabel.text = "Been here"
cell.valueLabel.text = (restaurant.isVisited) ? "Yes, I’ve been here before" : "No"
default:
cell.fieldLabel.text = ""
cell.valueLabel.text = ""
}
return cell
}
它是表格视图单元的模型。创建模型,然后使用此开关语句将“fieldLabel”文本更改为正确的值。然后将单元格放在表中,并将其呈现给用户/ 研究开关语句和iOS表视图单元格