summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-06-17 03:10:18 -0700
committerRui Marinho <me@ruimarinho.net>2016-06-17 11:10:18 +0100
commit925fc0aa588a060eb23fa16c1d225dd030012c23 (patch)
tree83676c25c29d97d9250516b217020ba85425796d /Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
parentd44396a4534b1e2bc81143c809e4adaee656ab15 (diff)
downloadxamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.gz
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.bz2
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.zip
Prep Cell & friends for removal of InternalsVisibleTo (#142)
* Prep Cell & friends for removal of InternalsVisibleTo Includes: - Cell - EntryCell - ListView - MenuItem - TableView - ViewCell - Toolbar Moved extensions to Internal & removed TPH * Update docs * [Controls] Ignore Issue2411 on iOS <9 * [Controls] Formatting for Issue2411
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
index dcb943bf..cc70a5f1 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
+using Xamarin.Forms.Internals;
#if __UNIFIED__
using UIKit;
using Foundation;
@@ -25,6 +26,8 @@ namespace Xamarin.Forms.Platform.iOS
{
readonly Dictionary<nint, Cell> _headerCells = new Dictionary<nint, Cell>();
+ protected ITableViewController Controller => View;
+
protected bool HasBoundGestures;
protected UITableView Table;
@@ -33,7 +36,7 @@ namespace Xamarin.Forms.Platform.iOS
public TableViewModelRenderer(TableView model)
{
View = model;
- View.ModelChanged += (s, e) =>
+ Controller.ModelChanged += (s, e) =>
{
if (Table != null)
Table.ReloadData();
@@ -45,7 +48,7 @@ namespace Xamarin.Forms.Platform.iOS
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
- var cell = View.Model.GetCell(indexPath.Section, indexPath.Row);
+ var cell = Controller.Model.GetCell(indexPath.Section, indexPath.Row);
var nativeCell = CellTableViewCell.GetNativeCell(tableView, cell);
return nativeCell;
@@ -54,7 +57,7 @@ namespace Xamarin.Forms.Platform.iOS
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
{
if (!_headerCells.ContainsKey((int)section))
- _headerCells[section] = View.Model.GetHeaderCell((int)section);
+ _headerCells[section] = Controller.Model.GetHeaderCell((int)section);
var result = _headerCells[section];
@@ -64,7 +67,7 @@ namespace Xamarin.Forms.Platform.iOS
public override UIView GetViewForHeader(UITableView tableView, nint section)
{
if (!_headerCells.ContainsKey((int)section))
- _headerCells[section] = View.Model.GetHeaderCell((int)section);
+ _headerCells[section] = Controller.Model.GetHeaderCell((int)section);
var result = _headerCells[section];
@@ -85,35 +88,35 @@ namespace Xamarin.Forms.Platform.iOS
if (indexPath == null)
return;
- View.Model.RowLongPressed(indexPath.Section, indexPath.Row);
+ Controller.Model.RowLongPressed(indexPath.Section, indexPath.Row);
}
public override nint NumberOfSections(UITableView tableView)
{
BindGestures(tableView);
- return View.Model.GetSectionCount();
+ return Controller.Model.GetSectionCount();
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
- View.Model.RowSelected(indexPath.Section, indexPath.Row);
+ Controller.Model.RowSelected(indexPath.Section, indexPath.Row);
if (AutomaticallyDeselect)
tableView.DeselectRow(indexPath, true);
}
public override nint RowsInSection(UITableView tableview, nint section)
{
- return View.Model.GetRowCount((int)section);
+ return Controller.Model.GetRowCount((int)section);
}
public override string[] SectionIndexTitles(UITableView tableView)
{
- return View.Model.GetSectionIndexTitles();
+ return Controller.Model.GetSectionIndexTitles();
}
public override string TitleForHeader(UITableView tableView, nint section)
{
- return View.Model.GetSectionTitle((int)section);
+ return Controller.Model.GetSectionTitle((int)section);
}
void BindGestures(UITableView tableview)