私は2つのカスタムUITableViewCell
を持っていて、ユーザーがボタンをタップすると現在tableView
にあるセルをループしたいと思っていました。私はtableView.visibleCells
メソッドを使って私のtableView
をループしました。私はループセルを介して、私はチェックして、forループNumericInputTableViewCell
かのif-else文でBooleanInputTableViewCell
を発見した場合によっては私のロジックコードを分離するときの間にチェックとアクセスのネームスペースを入力する方法
func doneButtonTapped() {
// TODO: - Need to collect user's input....
guard let node = node else {
return
}
var dict: Dictionary<String, Double>
let calculator = Calculator(module: node.value) // make it a failable initializer, so when user taps done without populating the inputs, it prompts them to
for cells in tableView.visibleCells {
if cells is NumericInputTableViewCell {
print("numeric cell")
// TODO: - Append to dictionary
cells. //Error
} else if cells is BooleanInputTableViewCell {
print("boolean cell")
//TODO: - Append to dictionary
cells. //Error
}
}
}
:ここに私のコードです。セルの名前空間にアクセスしようとしたときにエラーが発生し、xcodeが自動的に完了しませんでした。 ifステートメントでcells
を使用して、これらのカスタムセルにアクセスできるはずです。しかし、私はできませんでした。私は間違って何をしていますか?ありがとう!私のカスタムセルで
UPDATE
The error I got is "User of unresolved identifier 'cell'"
、私はnumericTitleLabel
というプロパティを持って、私はそれにアクセスしようとしたとき、それは私にそのエラーを与えました。
エラーは何ですか?あなたは単に細胞を持つことはできません。どうか明らかにしてください。 – rmaddy
Xcodeは自動的に自動補完されないので、コードが無効であるとは限りません。 – Sweeper
ありがとう、更新を参照してください –