小编Max*_*bak的帖子

SWIFT:tableview中的2个自定义单元格.怎么了?

我想放入2个自定义单元格TableView,但我遇到了一个小问题.我试图在Google和StackOverflow中找到答案,但答案无法帮助我.

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    if indexPath.row == 0{
        var cell: CustomCell = tableView.dequeueReusableCellWithIdentifier("FistCustomTableViewCell", forIndexPath: indexPath) as CustomCell
        //set cell2
    }
    if indexPath.row >= 1{
        var cell: CustomCell = tableView.dequeueReusableCellWithIdentifier("CustomTableViewCell", forIndexPath: indexPath) as CustomCell
        let cons = aArray[indexPath.row - 1]
        // set cell2 
    }
    return cell // (!) Use of unresolved identifier "cell"
}
Run Code Online (Sandbox Code Playgroud)

xcode uitableview ios swift

1
推荐指数
1
解决办法
4301
查看次数

标签 统计

ios ×1

swift ×1

uitableview ×1

xcode ×1