2015-07-21 88 views
0

我想遍歷包含自定義類「tempCell」的單元格的UITableView中的單元格,但是,我收到錯誤type of expression is ambiguous without more context遍歷UITableView中的自定義單元格

for cell in tableView.visibleCells() { 
    if let customCell as? TempCell { 
     customCell.textField.enabled = false 
    } 
} 

回答

0

當你迭代,你可以使用一個可選的綁定(if let)和有條件的低垂(as?)投了細胞對您的自定義類型customCell

for cell in tableView.visibleCell() { 
    if let customCell = cell as? TempCell { 
     customCell.textField.enabled = false 
    } 
} 
1

你必須'如果讓我們的:

let paths = tableView_sign_in.visibleCells() 
for cell: tempCell in paths { // type of expression is ambiguous without more context 
    cell.textfield.enabled = false 
}