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