title: get the indexpath of the cell containing the view in swift
body: <p>im trying to scroll to the a cell containing for example a specific uitextfield, <strong>it works if the table has only one section</strong>, but with <strong>more than 1 section it doesnt scroll</strong>, im using this extension</p>
  <pre><code>func indexPathForView(_ view: UIView) -&gt; IndexPath?
      {
          let center = view.center
          guard let superview = view.superview else {
              let origin = self.convert(view.bounds.origin, from: view)
              let indexPath = self.indexPathForRow(at: origin)
              return indexPath
          }
          let viewCenter = self.convert(center, from: superview)
          let indexPath = self.indexPathForRow(at: viewCenter)
  
          return indexPath
      }
  </code></pre>
  <p>thank you for your help</p>
  <p>here are the values</p>
  <p>when <strong>i have 1 section</strong> in the table</p>
  <p>center:
  ▿ (294.0, 46.5)</p>
  <ul>
  <li>x : 294.0</li>
  <li>y : 46.5</li>
  </ul>
  <p>viewCenter:
  ▿ (294.0, 309.5)</p>
  <ul>
  <li>x : 294.0</li>
  <li>y : 309.5</li>
  </ul>
  <p>indexPath:
  ▿ some : 2 elements
  - 0 : 0
  - 1 : 2</p>
  <p>when <strong>i have 2 sections</strong> in the table</p>
  <p>center:
  ▿ (294.0, 46.5)</p>
  <ul>
  <li>x : 294.0</li>
  <li>y : 46.5</li>
  </ul>
  <p>▿ (294.0, 1320.5)</p>
  <ul>
  <li>x : 294.0</li>
  <li>y : 1320.5</li>
  </ul>
  <p>indexPath:
  ▿ some : 2 elements
  - 0 : 1
  - 1 : 4</p>
  <p>it is the same cell, in the same section, but when i change the number of sctions at runtime this happens</p>