Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that link to <code>UINavigationController</code> (UI component) in <code>UITableViewSource</code> is a bit weird. I recommend to use event-based approach:</p> <ul> <li>Declare event in <code>UITableViewSource</code> and call it on row selection:</li> </ul> <pre class="lang-cs prettyprint-override"><code>public event Action&lt;int&gt; OnRowSelect; ... public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { tableView.DeselectRow (indexPath, true); // normal iOS behaviour is to remove the blue highlight if (OnRowSelect != null) { OnRowSelect(indexPath.Row); } } </code></pre> <ul> <li>Then, handle event on <code>UIViewController</code> - push new <code>UIViewController</code>:</li> </ul> <pre class="lang-cs prettyprint-override"><code>var source = data.ToArray(); source.OnRowSelect += HandleOnRowSelect; HotelSearchTable.Source = new HotelTableSource(); HotelSearchTable.ReloadData(); ... void HandleOnRowSelect(int index) { var data = items[index]; // Pass data to new view controller and push it } </code></pre> <p>Tip to avoid memory leaks: don't forget to unsubscribe from OnRowSelect when you <code>Pop</code> this <code>UIViewController</code> or making new <code>UITableViewSource</code> instance. I.e:</p> <ul> <li>Declare <code>source</code> in as class member;</li> <li>Unsubscribe from it's event in, for example, <code>ViewWillDisappear</code>:</li> </ul> <pre class="lang-cs prettyprint-override"><code>source.OnRowSelect -= HandleOnRowSelect; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload