Well I have a problem with my app. Just to say I m a beginner :) I have TableViewControler and I am using func with dequeueReusableCell to return a cell I that is ok. But the problem is how to implement this cell(s) with their values into a body mail using MFMailComposeViewController.setMessageBody? I m trying to pass an order which is in cells just like it is - in a table. That table a need to be visible in mail body. This parameter only takes String and cell is not visible (in scope here). Maybe should I transform cell into a html? And how should I do that?
//This values/cells I need to implement into a mail body//
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "OrderProductsCell", for: indexPath) as! OrderViewCell
let rowData = orderedProducts[indexPath.row]
cell.lblNameOfOrderProduct.text = rowData.selectedProducts.name + " " + rowData.selectedProducts.packaging + " " + rowData.selectedProducts.volume + " " + String(rowData.stepperNumber) + " x(kom)"
cell.lblFromDistributor.text = "Od"
cell.lblToStore.text = "Za"
cell.tfOrderFromDistibutor.text = String(rowData.distibutor)
cell.tfOrderToStore.text = String(rowData.store)
cell.tfOrderFromDistibutor.isUserInteractionEnabled = false
cell.tfOrderToStore.isUserInteractionEnabled = false
return cell
}
//This is MFMailComposeViewControlles - in the same Controller like Table View
func showMailComposer() {
guard MFMailComposeViewController.canSendMail() else {
defAlert(name: "You Can't sent mail", message: "")
return
}
let composer = MFMailComposeViewController()
composer.mailComposeDelegate = self
composer.setToRecipients(["[email protected]"])
composer.setSubject("Porudzbina")
composer.setMessageBody ("Here i need to implement cell", isHTML: false)
present(composer,animated: true)
}
numberOfRowsInSection
andcellForRowAt indexPath
which will be helpful to us to understand your issue. – Shawn Frank