我有一个有趣的问题。因为我是Swift新手。在自定义单元格内添加自定义单元格
我已在TableView上创建并使用Storyboard添加了CUSTOM CELL。现在我想添加一个自定义单元格当第一自定义单元格 UIButton的点击。
第二个自定义电池是使用XIB创建。现在当我注册第二个单元格didload然后我看到空白tableview作为第二个自定义单元格是空白。
我已经使用以下代码:
在索引登记第二小区
self.tableView.registerNib(UINib(nibName: "customCell", bundle: nil), forCellReuseIdentifier: "customCell")
和细胞用于行
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! Cell
cell.nameLbl.text = "Hello hello Hello"
let Customcell = tableView.dequeueReusableCellWithIdentifier("customCell", forIndexPath: indexPath) as! customCell
if self.Selected == "YES" {
if self.selectedValue == indexPath.row {
return Customcell
}
return cell
}
else{
return cell
}
}
这里Cell对象为故事板细胞和Customcell为XIB第二个定制单元。
请建议我该怎么做。