条件绑定:如果让错误 - 条件绑定的初始化程序必须具有可选类型
我试图从我的数据源和以下代码行中删除一行:
if let tv = tableView {导致以下错误:
条件绑定的初始化程序必须具有Optional类型,而不是UITableView
这是完整的代码:
// Override to support editing the table view.func tableView(tableView: UITableView, commitEditingStyle editingStyle:UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
if let tv = tableView {
myData.removeAtIndex(indexPath.row)
tv.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)我该如何纠正以下问题?
if let tv = tableView {繁星淼淼
UYOU
拉莫斯之舞