0
テーブルビュー、テキストフィールド、および更新ボタンがあります。テーブルビューのセル数は、テキストフィールドのユーザー入力によって決定されます。テーブルビューのセルには、ユーザーが何らかのデータを入力できるテキストフィールドのみが含まれています。 私が欲しいのは、その更新ボタンをクリックすると、テーブルビューのセルからユーザーが入力したデータを配列に保存したいと思っています。これを行う方法?これに最も適した方法は何ですか?動的に作成されたテーブルビューセルの入力フィールドからデータを配列に取得する方法
これは更新ボタンのコードです。
@IBAction func onUpdateButtonClick(sender: AnyObject) {
let tableViewLength = Int(productNumberTxtField.text!)! // TextField data which decides the table view cell count
for index in 0...(tableViewLength-1)
{
let indexPath = NSIndexPath(forRow: index, inSection: 0)
let cell = self.productsTableView.cellForRowAtIndexPath(indexPath) as? ProductCell
if(cell!.productTextField.text != "") { // productTextField is the text field in cell
UserDataController.sharedInstance.saveToProductsCoreData(userName, productName: (cell!.productTextField.text)!)
}
}
}
ウル疲れコード –
ここにあなたのコードを共有し、そうでない場合は、機密 – Krunal
@Vishnu Cyruz示し、あなたはいくつかのコードを試してみましたがそれ以外の場合は、配列 – iOS