title: Add textfiled and Send Button (mail to) in xcode
body: <p>i'm build a simple app that allows you to reserve information equipment or a seat in a classroom. In my table view i insert an image and some text. How can i add a text field and a button in the bottom that send me a mail with the summary of the booking?</p>
  
  <p>This is the code that i build until now.</p>
  
  <p><strong>TableViewController</strong></p>
  
  <pre><code>import UIKit
  struct CellData {
      let image : UIImage?
      let message : String?
  }
  class TableViewController: UITableViewController {
  
  var data = [CellData] ()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
  
      data = [CellData.init(image:  imageLiteral(resourceName: "printer"), message: "Stampante 3D"),CellData.init(image:  imageLiteral(resourceName: "printer"), message: "Stampante 3D"),CellData.init(image:  imageLiteral(resourceName: "printer"), message: "Stampante 3D")]
  
      self.tableView.register(CustomCell.self, forCellReuseIdentifier: "custom")
      self.tableView.rowHeight = UITableViewAutomaticDimension
      self.tableView.estimatedRowHeight = 200
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = self.tableView.dequeueReusableCell(withIdentifier: "custom") as! CustomCell
      cell.mainImage = data[indexPath.row].image
      cell.message = data[indexPath.row].message
      cell.layoutSubviews()
      return cell
  }
  
  
  override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return data.count
  }
  }
  </code></pre>
  
  <p><strong>Custom Cell</strong></p>
  
  <pre><code>import Foundation
  import UIKit
  
  class CustomCell: UITableViewCell {
  
  var message : String?
  var mainImage : UIImage?
  
  var messageView : UITextView = {
      var textView = UITextView()
      textView.translatesAutoresizingMaskIntoConstraints = false
      textView.isScrollEnabled = false
      return textView
  }()
  
  var mainImageView : UIImageView = {
      var imageView = UIImageView()
      imageView.translatesAutoresizingMaskIntoConstraints = false
      return imageView
  }()
  
  override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
      super.init(style: style, reuseIdentifier: reuseIdentifier)
      self.addSubview(mainImageView)
      self.addSubview(messageView)
  
      mainImageView.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
      mainImageView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
      mainImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
      mainImageView.widthAnchor.constraint(equalToConstant: 100).isActive = true
      mainImageView.heightAnchor.constraint(equalToConstant: 100).isActive = true
  
  
      messageView.leftAnchor.constraint(equalTo: self.mainImageView.rightAnchor).isActive = true
      messageView.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
      messageView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
      messageView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
  }
  
  override func layoutSubviews() {
      super.layoutSubviews()
      if let message = message {
          messageView.text = message
      }
      if let image = mainImage{
          mainImageView.image = image
  }        }
  
  
  
  required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
  }
  }
  </code></pre>
  
  <p>Thanks!</p>