我确定之前已经问过这个问题,但我找不到一个能够解决嵌套if-else和switch-case逻辑问题的答案.
我有UITableView两个部分,每个部分有两个自定义单元格.就是这样.4个细胞.但无论我做什么,我都会得到"在预期返回的功能中失去回归UITableViewCell"
问题如何更改此设置以便在底部获得一个满足快速逻辑的else语句?
任何帮助将非常感谢
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.section == 0{
switch (indexPath.row) {
case 0:
let cell0: SettingsCell! = tableView.dequeueReusableCellWithIdentifier("cell0", forIndexPath: indexPath) as! SettingsCell
cell0.backgroundColor = UIColor.redColor()
break
case 1:
let cell1: SettingsCell! = tableView.dequeueReusableCellWithIdentifier("cell1", forIndexPath: indexPath) as! SettingsCell
cell1.backgroundColor = UIColor.whiteColor()
break
default:
break
}
}
if indexPath.section == 1{
switch (indexPath.row) {
case 0:
let cell10: SettingsCell! = tableView.dequeueReusableCellWithIdentifier("cell10", forIndexPath: indexPath) as! SettingsCell
cell10.backgroundColor = …Run Code Online (Sandbox Code Playgroud)