summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authorkingces95 <kingces95@users.noreply.github.com>2017-04-11 18:02:06 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-04-11 18:02:06 (GMT)
commit093a4efa2da9cb681890158ca8ee9bb6f30b0a8c (patch)
treeccc17255876e40d2c845d7b2c62dfc930156729d /Xamarin.Forms.Platform.iOS
parent7458ca37330f424bf7fb1447580b0fa9c34c6db4 (diff)
downloadxamarin-forms-093a4efa2da9cb681890158ca8ee9bb6f30b0a8c.zip
xamarin-forms-093a4efa2da9cb681890158ca8ee9bb6f30b0a8c.tar.gz
xamarin-forms-093a4efa2da9cb681890158ca8ee9bb6f30b0a8c.tar.bz2
Implicit impl of controller ifaces (#807)
* Simplify ICtrl callsites * Rebase fix
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs14
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs15
-rw-r--r--Xamarin.Forms.Platform.iOS/ContextActionCell.cs16
-rw-r--r--Xamarin.Forms.Platform.iOS/EventTracker.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs15
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs55
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs31
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs22
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs17
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs19
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs22
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs28
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs28
18 files changed, 143 insertions, 167 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs
index 2c0ffb4..23038de 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs
@@ -19,19 +19,17 @@ namespace Xamarin.Forms.Platform.iOS
get { return _cell; }
set
{
- if (_cell == value)
+ if (this._cell == value)
return;
- ICellController cellController = _cell;
-
- if (cellController != null)
- Device.BeginInvokeOnMainThread(cellController.SendDisappearing);
+ if (_cell != null)
+ Device.BeginInvokeOnMainThread(_cell.SendDisappearing);
+ this._cell = value;
_cell = value;
- cellController = value;
- if (cellController != null)
- Device.BeginInvokeOnMainThread(cellController.SendAppearing);
+ if (_cell != null)
+ Device.BeginInvokeOnMainThread(_cell.SendAppearing);
}
}
diff --git a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs
index 3957feb..d30d439 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs
@@ -150,14 +150,13 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateCell(ViewCell cell)
{
- ICellController cellController = _viewCell;
- if (cellController != null)
- Device.BeginInvokeOnMainThread(cellController.SendDisappearing);
+ if (_viewCell != null)
+ Device.BeginInvokeOnMainThread(_viewCell.SendDisappearing);
+ this._viewCell = cell;
_viewCell = cell;
- cellController = cell;
- Device.BeginInvokeOnMainThread(cellController.SendAppearing);
+ Device.BeginInvokeOnMainThread(_viewCell.SendAppearing);
IVisualElementRenderer renderer;
if (_rendererRef == null || !_rendererRef.TryGetTarget(out renderer))
@@ -167,9 +166,9 @@ namespace Xamarin.Forms.Platform.iOS
if (renderer.Element != null && renderer == Platform.GetRenderer(renderer.Element))
renderer.Element.ClearValue(Platform.RendererProperty);
- var type = Internals.Registrar.Registered.GetHandlerType(_viewCell.View.GetType());
+ var type = Internals.Registrar.Registered.GetHandlerType(this._viewCell.View.GetType());
if (renderer.GetType() == type || (renderer is Platform.DefaultRenderer && type == null))
- renderer.SetElement(_viewCell.View);
+ renderer.SetElement(this._viewCell.View);
else
{
//when cells are getting reused the element could be already set to another cell
@@ -180,7 +179,7 @@ namespace Xamarin.Forms.Platform.iOS
}
}
- Platform.SetRenderer(_viewCell.View, renderer);
+ Platform.SetRenderer(this._viewCell.View, renderer);
}
}
}
diff --git a/Xamarin.Forms.Platform.iOS/ContextActionCell.cs b/Xamarin.Forms.Platform.iOS/ContextActionCell.cs
index 12db22a..1b19e9b 100644
--- a/Xamarin.Forms.Platform.iOS/ContextActionCell.cs
+++ b/Xamarin.Forms.Platform.iOS/ContextActionCell.cs
@@ -117,7 +117,7 @@ namespace Xamarin.Forms.Platform.iOS
public void Update(UITableView tableView, Cell cell, UITableViewCell nativeCell)
{
- var parentListView = cell.RealParent as IListViewController;
+ var parentListView = cell.RealParent as ListView;
var recycling = parentListView != null && parentListView.CachingStrategy == ListViewCachingStrategy.RecycleElement;
if (_cell != cell && recycling)
{
@@ -322,7 +322,7 @@ namespace Xamarin.Forms.Platform.iOS
_scroller.SetContentOffset(new PointF(0, 0), true);
MenuItem mi;
if (weakItem.TryGetTarget(out mi))
- ((IMenuItemController)mi).Activate();
+ mi.Activate();
});
actionSheet.AddAction(action);
}
@@ -399,7 +399,7 @@ namespace Xamarin.Forms.Platform.iOS
button.SetTitle(item.Text, UIControlState.Normal);
button.TitleEdgeInsets = new UIEdgeInsets(0, 15, 0, 15);
- button.Enabled = ((IMenuItemController)item).IsEnabled;
+ button.Enabled = item.IsEnabled;
return button;
}
@@ -440,7 +440,7 @@ namespace Xamarin.Forms.Platform.iOS
else
{
_scroller.SetContentOffset(new PointF(0, 0), true);
- ((IMenuItemController)_cell.ContextActions[(int)button.Tag]).Activate();
+ _cell.ContextActions[(int)button.Tag].Activate();
}
}
@@ -448,7 +448,7 @@ namespace Xamarin.Forms.Platform.iOS
{
if (e.PropertyName == "HasContextActions")
{
- var parentListView = _cell.RealParent as IListViewController;
+ var parentListView = _cell.RealParent as ListView;
var recycling = parentListView != null && parentListView.CachingStrategy == ListViewCachingStrategy.RecycleElement;
if (!recycling)
ReloadRow();
@@ -457,7 +457,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnContextItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
- var parentListView = _cell.RealParent as IListViewController;
+ var parentListView = _cell.RealParent as ListView;
var recycling = parentListView != null && parentListView.CachingStrategy == ListViewCachingStrategy.RecycleElement;
if (recycling)
Update(_tableView, _cell, ContentCell);
@@ -468,7 +468,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnMenuItemPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- var parentListView = _cell.RealParent as IListViewController;
+ var parentListView = _cell.RealParent as ListView;
var recycling = parentListView != null && parentListView.CachingStrategy == ListViewCachingStrategy.RecycleElement;
if (recycling)
Update(_tableView, _cell, ContentCell);
@@ -690,7 +690,7 @@ namespace Xamarin.Forms.Platform.iOS
// do not activate a -1 index when dismissing by clicking outside the popover
if (buttonIndex >= 0)
- ((IMenuItemController)Items[(int)buttonIndex]).Activate();
+ Items[(int)buttonIndex].Activate();
}
}
}
diff --git a/Xamarin.Forms.Platform.iOS/EventTracker.cs b/Xamarin.Forms.Platform.iOS/EventTracker.cs
index 8fe1d1d..48f3064 100644
--- a/Xamarin.Forms.Platform.iOS/EventTracker.cs
+++ b/Xamarin.Forms.Platform.iOS/EventTracker.cs
@@ -119,7 +119,7 @@ namespace Xamarin.Forms.Platform.MacOS
double startingScale = 1;
var uiRecognizer = CreatePinchRecognizer(r =>
{
- var pinchGestureRecognizer = weakRecognizer.Target as IPinchGestureController;
+ var pinchGestureRecognizer = weakRecognizer.Target as PinchGestureRecognizer;
var eventTracker = weakEventTracker.Target as EventTracker;
var view = eventTracker?._renderer?.Element as View;
@@ -190,7 +190,7 @@ namespace Xamarin.Forms.Platform.MacOS
var eventTracker = weakEventTracker.Target as EventTracker;
var view = eventTracker?._renderer?.Element as View;
- var panGestureRecognizer = weakRecognizer.Target as IPanGestureController;
+ var panGestureRecognizer = weakRecognizer.Target as PanGestureRecognizer;
if (panGestureRecognizer != null && view != null)
{
switch (r.State)
diff --git a/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs
index 84cea86..872ced3 100644
--- a/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs
@@ -19,8 +19,6 @@ namespace Xamarin.Forms.Platform.iOS
readonly bool _forceName;
readonly ToolbarItem _item;
- IMenuItemController Controller => _item;
-
public PrimaryToolbarItem(ToolbarItem item, bool forceName)
{
_forceName = forceName;
@@ -32,7 +30,7 @@ namespace Xamarin.Forms.Platform.iOS
UpdateTextAndStyle();
UpdateIsEnabled();
- Clicked += (sender, e) => Controller.Activate();
+ Clicked += (sender, e) => _item.Activate();
item.PropertyChanged += OnPropertyChanged;
if (item != null && !string.IsNullOrEmpty(item.AutomationId))
@@ -48,7 +46,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == Controller.IsEnabledPropertyName)
+ if (e.PropertyName == _item.IsEnabledPropertyName)
UpdateIsEnabled();
else if (e.PropertyName == MenuItem.TextProperty.PropertyName)
{
@@ -77,7 +75,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateIsEnabled()
{
- Enabled = Controller.IsEnabled;
+ Enabled = _item.IsEnabled;
}
void UpdateTextAndStyle()
@@ -91,7 +89,6 @@ namespace Xamarin.Forms.Platform.iOS
sealed class SecondaryToolbarItem : UIBarButtonItem
{
readonly ToolbarItem _item;
- IMenuItemController Controller => _item;
public SecondaryToolbarItem(ToolbarItem item) : base(new SecondaryToolbarItemContent())
{
@@ -100,7 +97,7 @@ namespace Xamarin.Forms.Platform.iOS
UpdateIcon();
UpdateIsEnabled();
- ((SecondaryToolbarItemContent)CustomView).TouchUpInside += (sender, e) => Controller.Activate();
+ ((SecondaryToolbarItemContent)CustomView).TouchUpInside += (sender, e) => _item.Activate();
item.PropertyChanged += OnPropertyChanged;
if (item != null && !string.IsNullOrEmpty(item.AutomationId))
@@ -120,7 +117,7 @@ namespace Xamarin.Forms.Platform.iOS
UpdateText();
else if (e.PropertyName == MenuItem.IconProperty.PropertyName)
UpdateIcon();
- else if (e.PropertyName == Controller.IsEnabledPropertyName)
+ else if (e.PropertyName == _item.IsEnabledPropertyName)
UpdateIsEnabled();
}
@@ -137,7 +134,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateIsEnabled()
{
- ((UIControl)CustomView).Enabled = Controller.IsEnabled;
+ ((UIControl)CustomView).Enabled = _item.IsEnabled;
}
void UpdateText()
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
index 760a714..6e11d96 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
@@ -106,7 +106,7 @@ namespace Xamarin.Forms.Platform.iOS
IImageSourceHandler handler;
- ((IImageController)Element).SetIsLoading(true);
+ Element.SetIsLoading(true);
if (source != null && (handler = Internals.Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null)
{
@@ -131,7 +131,7 @@ namespace Xamarin.Forms.Platform.iOS
Control.Image = null;
if (!_isDisposed)
- ((IImageController)Element).SetIsLoading(false);
+ Element.SetIsLoading(false);
}
void SetOpacity()
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
index 9eaeb78..2a20a67 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
@@ -26,7 +26,7 @@ namespace Xamarin.Forms.Platform.iOS
bool _shouldEstimateRowHeight = true;
FormsUITableViewController _tableViewController;
- IListViewController Controller => Element;
+ ListView ListView => Element;
ITemplatedItemsView<Cell> TemplatedItemsView => Element;
public override UIViewController ViewController => _tableViewController;
bool _disposed;
@@ -156,12 +156,12 @@ namespace Xamarin.Forms.Platform.iOS
_footerRenderer = null;
}
- var headerView = Controller?.HeaderElement as VisualElement;
+ var headerView = ListView?.HeaderElement as VisualElement;
if (headerView != null)
headerView.MeasureInvalidated -= OnHeaderMeasureInvalidated;
Control?.TableHeaderView?.Dispose();
- var footerView = Controller?.FooterElement as VisualElement;
+ var footerView = ListView?.FooterElement as VisualElement;
if (footerView != null)
footerView.MeasureInvalidated -= OnFooterMeasureInvalidated;
Control?.TableFooterView?.Dispose();
@@ -178,16 +178,16 @@ namespace Xamarin.Forms.Platform.iOS
if (e.OldElement != null)
{
- var controller = (IListViewController)e.OldElement;
- var headerView = (VisualElement)controller.HeaderElement;
+ var listView = e.OldElement;
+ var headerView = (VisualElement)listView.HeaderElement;
if (headerView != null)
headerView.MeasureInvalidated -= OnHeaderMeasureInvalidated;
- var footerView = (VisualElement)controller.FooterElement;
+ var footerView = (VisualElement)listView.FooterElement;
if (footerView != null)
footerView.MeasureInvalidated -= OnFooterMeasureInvalidated;
- controller.ScrollToRequested -= OnScrollToRequested;
+ listView.ScrollToRequested -= OnScrollToRequested;
var templatedItems = ((ITemplatedItemsView<Cell>)e.OldElement).TemplatedItems;
templatedItems.CollectionChanged -= OnCollectionChanged;
@@ -212,9 +212,9 @@ namespace Xamarin.Forms.Platform.iOS
}
_shouldEstimateRowHeight = true;
- var controller = (IListViewController)e.NewElement;
+ var listView = e.NewElement;
- controller.ScrollToRequested += OnScrollToRequested;
+ listView.ScrollToRequested += OnScrollToRequested;
var templatedItems = ((ITemplatedItemsView<Cell>)e.NewElement).TemplatedItems;
templatedItems.CollectionChanged += OnCollectionChanged;
@@ -243,22 +243,22 @@ namespace Xamarin.Forms.Platform.iOS
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
- if (e.PropertyName == ListView.RowHeightProperty.PropertyName)
+ if (e.PropertyName == Xamarin.Forms.ListView.RowHeightProperty.PropertyName)
UpdateRowHeight();
- else if (e.PropertyName == ListView.IsGroupingEnabledProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.ListView.IsGroupingEnabledProperty.PropertyName)
_dataSource.UpdateGrouping();
- else if (e.PropertyName == ListView.HasUnevenRowsProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.ListView.HasUnevenRowsProperty.PropertyName)
{
_estimatedRowHeight = false;
Control.Source = _dataSource = Element.HasUnevenRows ? new UnevenListViewDataSource(_dataSource) : new ListViewDataSource(_dataSource);
}
- else if (e.PropertyName == ListView.IsPullToRefreshEnabledProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.ListView.IsPullToRefreshEnabledProperty.PropertyName)
UpdatePullToRefreshEnabled();
- else if (e.PropertyName == ListView.IsRefreshingProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.ListView.IsRefreshingProperty.PropertyName)
UpdateIsRefreshing();
- else if (e.PropertyName == ListView.SeparatorColorProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.ListView.SeparatorColorProperty.PropertyName)
UpdateSeparatorColor();
- else if (e.PropertyName == ListView.SeparatorVisibilityProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.ListView.SeparatorVisibilityProperty.PropertyName)
UpdateSeparatorVisibility();
else if (e.PropertyName == "HeaderElement")
UpdateHeader();
@@ -395,7 +395,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateFooter()
{
- var footer = Controller.FooterElement;
+ var footer = ListView.FooterElement;
var footerView = (View)footer;
if (footerView != null)
@@ -441,7 +441,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateHeader()
{
- var header = Controller.HeaderElement;
+ var header = ListView.HeaderElement;
var headerView = (View)header;
if (headerView != null)
@@ -574,7 +574,7 @@ namespace Xamarin.Forms.Platform.iOS
{
if (_tableViewController != null)
{
- var isPullToRequestEnabled = Element.IsPullToRefreshEnabled && Controller.RefreshAllowed;
+ var isPullToRequestEnabled = Element.IsPullToRefreshEnabled && ListView.RefreshAllowed;
_tableViewController.UpdatePullToRefreshEnabled(isPullToRequestEnabled);
}
}
@@ -730,7 +730,6 @@ namespace Xamarin.Forms.Platform.iOS
UITableView _uiTableView;
FormsUITableViewController _uiTableViewController;
protected ListView List;
- IListViewController Controller => List;
protected ITemplatedItemsView<Cell> TemplatedItemsView => List;
bool _isDragging;
bool _selectionFromNative;
@@ -783,7 +782,7 @@ namespace Xamarin.Forms.Platform.iOS
Cell cell;
UITableViewCell nativeCell;
- var cachingStrategy = Controller.CachingStrategy;
+ var cachingStrategy = List.CachingStrategy;
if (cachingStrategy == ListViewCachingStrategy.RetainElement)
{
cell = GetCellForPath(indexPath);
@@ -801,11 +800,12 @@ namespace Xamarin.Forms.Platform.iOS
else
{
var templatedList = TemplatedItemsView.TemplatedItems.GetGroup(indexPath.Section);
+
cell = (Cell)((INativeElementView)nativeCell).Element;
- ICellController controller = cell;
- controller.SendDisappearing();
+ cell.SendDisappearing();
+
templatedList.UpdateContent(cell, indexPath.Row);
- controller.SendAppearing();
+ cell.SendAppearing();
}
}
else
@@ -911,7 +911,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
Cell formsCell = null;
- if (Controller.CachingStrategy == ListViewCachingStrategy.RecycleElement)
+ if (List.CachingStrategy == ListViewCachingStrategy.RecycleElement)
formsCell = (Cell)((INativeElementView)cell).Element;
SetCellBackgroundColor(cell, UIColor.Clear);
@@ -920,7 +920,7 @@ namespace Xamarin.Forms.Platform.iOS
_selectionFromNative = true;
tableView.EndEditing(true);
- Controller.NotifyRowTapped(indexPath.Section, indexPath.Row, formsCell);
+ List.NotifyRowTapped(indexPath.Section, indexPath.Row, formsCell);
}
public override nint RowsInSection(UITableView tableview, nint section)
@@ -1114,7 +1114,6 @@ namespace Xamarin.Forms.Platform.iOS
internal class FormsUITableViewController : UITableViewController
{
ListView _list;
- IListViewController Controller => _list;
UIRefreshControl _refresh;
bool _refreshAdded;
@@ -1233,7 +1232,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnRefreshingChanged(object sender, EventArgs eventArgs)
{
if (_refresh.Refreshing)
- Controller.SendRefreshing();
+ _list.SendRefreshing();
}
void RemoveRefresh()
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs
index af823a4..e58de35 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs
@@ -110,8 +110,6 @@ namespace Xamarin.Forms.Platform.iOS
_menu = menu;
}
- INavigationMenuController MenuController => _menu;
-
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
var cell = (NavigationCell)collectionView.DequeueReusableCell(new NSString("NavigationCell"), indexPath);
@@ -121,7 +119,7 @@ namespace Xamarin.Forms.Platform.iOS
{
cell.Name = target.Title;
cell.Icon = target.Icon?.File;
- cell.Selected = () => MenuController.SendTargetSelected(target);
+ cell.Selected = () => _menu.SendTargetSelected(target);
}
else
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
index 2ca9611..99ff079 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
@@ -196,20 +196,18 @@ namespace Xamarin.Forms.Platform.iOS
"NavigationPage must have a root Page before being used. Either call PushAsync with a valid Page, or pass a Page to the constructor before usage.");
}
- var navController = ((INavigationPageController)navPage);
-
- navController.PushRequested += OnPushRequested;
- navController.PopRequested += OnPopRequested;
- navController.PopToRootRequested += OnPopToRootRequested;
- navController.RemovePageRequested += OnRemovedPageRequested;
- navController.InsertPageBeforeRequested += OnInsertPageBeforeRequested;
+ navPage.PushRequested += OnPushRequested;
+ navPage.PopRequested += OnPopRequested;
+ navPage.PopToRootRequested += OnPopToRootRequested;
+ navPage.RemovePageRequested += OnRemovedPageRequested;
+ navPage.InsertPageBeforeRequested += OnInsertPageBeforeRequested;
UpdateTint();
UpdateBarBackgroundColor();
UpdateBarTextColor();
// If there is already stuff on the stack we need to push it
- ((INavigationPageController)navPage).Pages.ForEach(async p => await PushPageAsync(p, false));
+ navPage.Pages.ForEach(async p => await PushPageAsync(p, false));
_tracker = new VisualElementTracker(this);
@@ -242,12 +240,11 @@ namespace Xamarin.Forms.Platform.iOS
var navPage = (NavigationPage)Element;
navPage.PropertyChanged -= HandlePropertyChanged;
- var navController = ((INavigationPageController)navPage);
- navController.PushRequested -= OnPushRequested;
- navController.PopRequested -= OnPopRequested;
- navController.PopToRootRequested -= OnPopToRootRequested;
- navController.RemovePageRequested -= OnRemovedPageRequested;
- navController.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
+ navPage.PushRequested -= OnPushRequested;
+ navPage.PopRequested -= OnPopRequested;
+ navPage.PopToRootRequested -= OnPopToRootRequested;
+ navPage.RemovePageRequested -= OnRemovedPageRequested;
+ navPage.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
}
base.Dispose(disposing);
@@ -547,7 +544,7 @@ namespace Xamarin.Forms.Platform.iOS
for (var i = 0; i < removed; i++)
{
// lets just pop these suckers off, do not await, the true is there to make this fast
- await ((INavigationPageController)Element).PopAsyncInner(animated, true);
+ await ((NavigationPage)Element).PopAsyncInner(animated, true);
}
// because we skip the normal pop process we need to dispose ourselves
controller.Dispose();
@@ -622,7 +619,7 @@ namespace Xamarin.Forms.Platform.iOS
if (containerController == null)
return;
var currentChild = containerController.Child;
- var firstPage = ((INavigationPageController)Element).Pages.FirstOrDefault();
+ var firstPage = ((NavigationPage)Element).Pages.FirstOrDefault();
if ((firstPage != pageBeingRemoved && currentChild != firstPage && NavigationPage.GetHasBackButton(currentChild)) || _parentMasterDetailPage == null)
return;
@@ -849,7 +846,7 @@ namespace Xamarin.Forms.Platform.iOS
{
if (disposing)
{
- ((IPageController)Child).SendDisappearing();
+ Child.SendDisappearing();
if (Child != null)
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs
index 58c172c..619aaad 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs
@@ -28,7 +28,7 @@ namespace Xamarin.Forms.Platform.iOS
_displayLink = null;
if (Element != null)
- ((IOpenGlViewController)Element).DisplayRequested -= Display;
+ Element.DisplayRequested -= Display;
}
base.Dispose(disposing);
@@ -37,7 +37,7 @@ namespace Xamarin.Forms.Platform.iOS
protected override void OnElementChanged(ElementChangedEventArgs<OpenGLView> e)
{
if (e.OldElement != null)
- ((IOpenGlViewController)e.OldElement).DisplayRequested -= Display;
+ e.OldElement.DisplayRequested -= Display;
if (e.NewElement != null)
{
@@ -45,7 +45,7 @@ namespace Xamarin.Forms.Platform.iOS
var glkView = new GLKView(RectangleF.Empty) { Context = context, DrawableDepthFormat = GLKViewDrawableDepthFormat.Format24, Delegate = new Delegate(e.NewElement) };
SetNativeControl(glkView);
- ((IOpenGlViewController)e.NewElement).DisplayRequested += Display;
+ e.NewElement.DisplayRequested += Display;
SetupRenderLoop(false);
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
index f7e3127..cd7bdc6 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
@@ -16,7 +16,7 @@ namespace Xamarin.Forms.Platform.iOS
VisualElementPackager _packager;
VisualElementTracker _tracker;
- IPageController PageController => Element as IPageController;
+ Page Page => Element as Page;
public PageRenderer()
{
@@ -73,7 +73,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
_appeared = true;
- PageController.SendAppearing();
+ Page.SendAppearing();
UpdateStatusBarPrefersHidden();
}
@@ -85,7 +85,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
_appeared = false;
- PageController.SendDisappearing();
+ Page.SendDisappearing();
}
public override void ViewDidLoad()
@@ -128,7 +128,7 @@ namespace Xamarin.Forms.Platform.iOS
Element.PropertyChanged -= OnHandlePropertyChanged;
Platform.SetRenderer(Element, null);
if (_appeared)
- PageController.SendDisappearing();
+ Page.SendDisappearing();
_appeared = false;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
index fbadc77..12d54fa 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
@@ -24,13 +24,13 @@ namespace Xamarin.Forms.Platform.iOS
VisualElementTracker _tracker;
- IPageController PageController => Element as IPageController;
+ Page Page => Element as Page;
public PhoneMasterDetailRenderer()
{
}
- IMasterDetailPageController MasterDetailPageController => Element as IMasterDetailPageController;
+ MasterDetailPage MasterDetailPage => Element as MasterDetailPage;
bool Presented
{
@@ -46,7 +46,7 @@ namespace Xamarin.Forms.Platform.iOS
else
RemoveClickOffView();
- ((IElementController)Element).SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, value);
+ ((IElementController)Element).SetValueFromRenderer(Xamarin.Forms.MasterDetailPage.IsPresentedProperty, value);
}
}
@@ -99,13 +99,13 @@ namespace Xamarin.Forms.Platform.iOS
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
- PageController.SendAppearing();
+ Page.SendAppearing();
}
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
- PageController?.SendDisappearing();
+ Page?.SendDisappearing();
}
public override void ViewDidLayoutSubviews()
@@ -142,7 +142,7 @@ namespace Xamarin.Forms.Platform.iOS
public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
{
- if (!MasterDetailPageController.ShouldShowSplitMode && _presented)
+ if (!MasterDetailPage.ShouldShowSplitMode && _presented)
Presented = false;
base.WillRotate(toInterfaceOrientation, duration);
@@ -185,7 +185,7 @@ namespace Xamarin.Forms.Platform.iOS
EmptyContainers();
- PageController.SendDisappearing();
+ Page.SendDisappearing();
_disposed = true;
}
@@ -225,9 +225,9 @@ namespace Xamarin.Forms.Platform.iOS
{
if (e.PropertyName == "Master" || e.PropertyName == "Detail")
UpdateMasterDetailContainers();
- else if (e.PropertyName == MasterDetailPage.IsPresentedProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.MasterDetailPage.IsPresentedProperty.PropertyName)
Presented = ((MasterDetailPage)Element).IsPresented;
- else if (e.PropertyName == MasterDetailPage.IsGestureEnabledProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.MasterDetailPage.IsGestureEnabledProperty.PropertyName)
UpdatePanGesture();
else if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
UpdateBackground();
@@ -259,8 +259,8 @@ namespace Xamarin.Forms.Platform.iOS
else
_detailController.View.Frame = target;
- MasterDetailPageController.MasterBounds = new Rectangle(0, 0, masterFrame.Width, masterFrame.Height);
- MasterDetailPageController.DetailBounds = new Rectangle(0, 0, frame.Width, frame.Height);
+ MasterDetailPage.MasterBounds = new Rectangle(0, 0, masterFrame.Width, masterFrame.Height);
+ MasterDetailPage.DetailBounds = new Rectangle(0, 0, frame.Width, frame.Height);
if (Presented)
_clickOffView.Frame = _detailController.View.Frame;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
index 1fe2edb..4001c3d 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
@@ -25,11 +25,6 @@ namespace Xamarin.Forms.Platform.iOS
Scrolled += HandleScrolled;
}
- protected IScrollViewController Controller
- {
- get { return (IScrollViewController)Element; }
- }
-
ScrollView ScrollView
{
get { return Element as ScrollView; }
@@ -58,13 +53,13 @@ namespace Xamarin.Forms.Platform.iOS
if (oldElement != null)
{
oldElement.PropertyChanged -= HandlePropertyChanged;
- ((IScrollViewController)oldElement).ScrollToRequested -= OnScrollToRequested;
+ ((ScrollView)oldElement).ScrollToRequested -= OnScrollToRequested;
}
if (element != null)
{
element.PropertyChanged += HandlePropertyChanged;
- ((IScrollViewController)element).ScrollToRequested += OnScrollToRequested;
+ ((ScrollView)element).ScrollToRequested += OnScrollToRequested;
if (_packager == null)
{
_packager = new VisualElementPackager(this);
@@ -175,7 +170,7 @@ namespace Xamarin.Forms.Platform.iOS
void HandleScrollAnimationEnded(object sender, EventArgs e)
{
- Controller.SendScrollFinished();
+ ScrollView.SendScrollFinished();
}
void HandleScrolled(object sender, EventArgs e)
@@ -200,7 +195,7 @@ namespace Xamarin.Forms.Platform.iOS
SetContentOffset(new PointF((nfloat)e.ScrollX, (nfloat)e.ScrollY), e.ShouldAnimate);
else
{
- var positionOnScroll = Controller.GetScrollPositionForElement(e.Element as VisualElement, e.Position);
+ var positionOnScroll = ScrollView.GetScrollPositionForElement(e.Element as VisualElement, e.Position);
positionOnScroll.X = positionOnScroll.X.Clamp(0, ContentSize.Width - Bounds.Size.Width);
positionOnScroll.Y = positionOnScroll.Y.Clamp(0, ContentSize.Height - Bounds.Size.Height);
@@ -219,7 +214,7 @@ namespace Xamarin.Forms.Platform.iOS
}
}
if (!e.ShouldAnimate)
- Controller.SendScrollFinished();
+ ScrollView.SendScrollFinished();
}
void UpdateDelaysContentTouches()
@@ -242,7 +237,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateScrollPosition()
{
if (ScrollView != null)
- Controller.SetScrolledPosition(ContentOffset.X, ContentOffset.Y);
+ ScrollView.SetScrolledPosition(ContentOffset.X, ContentOffset.Y);
}
void IEffectControlProvider.RegisterEffect(Effect effect)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
index 96fb020..b0f6e49 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
@@ -137,7 +137,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnSearchButtonClicked(object sender, EventArgs e)
{
- ((ISearchBarController)Element).OnSearchButtonPressed();
+ Element.OnSearchButtonPressed();
Control.ResignFirstResponder();
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
index 8b943b6..9515466 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
@@ -21,8 +21,7 @@ namespace Xamarin.Forms.Platform.iOS
bool _loaded;
Size _queuedSize;
- IPageController PageController => Element as IPageController;
- IElementController ElementController => Element as IElementController;
+ Page Page => Element as Page;
public override UIViewController SelectedViewController
{
@@ -100,14 +99,14 @@ namespace Xamarin.Forms.Platform.iOS
public override void ViewDidAppear(bool animated)
{
- PageController.SendAppearing();
+ Page.SendAppearing();
base.ViewDidAppear(animated);
}
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
- PageController.SendDisappearing();
+ Page.SendDisappearing();
}
public override void ViewDidLayoutSubviews()
@@ -124,7 +123,7 @@ namespace Xamarin.Forms.Platform.iOS
var frame = View.Frame;
var tabBarFrame = TabBar.Frame;
- PageController.ContainerArea = new Rectangle(0, 0, frame.Width, frame.Height - tabBarFrame.Height);
+ Page.ContainerArea = new Rectangle(0, 0, frame.Width, frame.Height - tabBarFrame.Height);
if (!_queuedSize.IsZero)
{
@@ -139,7 +138,7 @@ namespace Xamarin.Forms.Platform.iOS
{
if (disposing)
{
- PageController.SendDisappearing();
+ Page.SendDisappearing();
Tabbed.PropertyChanged -= OnPropertyChanged;
Tabbed.PagesChanged -= OnPagesChanged;
FinishedCustomizingViewControllers -= HandleFinishedCustomizingViewControllers;
@@ -267,9 +266,9 @@ namespace Xamarin.Forms.Platform.iOS
void SetControllers()
{
var list = new List<UIViewController>();
- for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
+ for (var i = 0; i < Element.LogicalChildren.Count; i++)
{
- var child = ElementController.LogicalChildren[i];
+ var child = Element.LogicalChildren[i];
var v = child as VisualElement;
if (v == null)
continue;
@@ -368,7 +367,7 @@ namespace Xamarin.Forms.Platform.iOS
var originalIndex = -1;
if (int.TryParse(viewControllers[i].TabBarItem.Tag.ToString(), out originalIndex))
{
- var page = (Page)((IPageController)Tabbed).InternalChildren[originalIndex];
+ var page = (Page)Tabbed.InternalChildren[originalIndex];
TabbedPage.SetIndex(page, i);
}
}
@@ -376,7 +375,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateCurrentPage()
{
- var count = ((IPageController)Tabbed).InternalChildren.Count;
+ var count = Tabbed.InternalChildren.Count;
var index = (int)SelectedIndex;
((TabbedPage)Element).CurrentPage = index >= 0 && index < count ? Tabbed.GetPageByIndex(index) : null;
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
index 060b9d2..dea20da 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
@@ -9,8 +9,6 @@ namespace Xamarin.Forms.Platform.iOS
{
readonly Dictionary<nint, Cell> _headerCells = new Dictionary<nint, Cell>();
- protected ITableViewController Controller => View;
-
protected bool HasBoundGestures;
protected UITableView Table;
@@ -19,7 +17,7 @@ namespace Xamarin.Forms.Platform.iOS
public TableViewModelRenderer(TableView model)
{
View = model;
- Controller.ModelChanged += (s, e) =>
+ View.ModelChanged += (s, e) =>
{
if (Table != null)
Table.ReloadData();
@@ -31,7 +29,7 @@ namespace Xamarin.Forms.Platform.iOS
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
- var cell = Controller.Model.GetCell(indexPath.Section, indexPath.Row);
+ var cell = View.Model.GetCell(indexPath.Section, indexPath.Row);
var nativeCell = CellTableViewCell.GetNativeCell(tableView, cell);
return nativeCell;
@@ -40,7 +38,7 @@ namespace Xamarin.Forms.Platform.iOS
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
{
if (!_headerCells.ContainsKey((int)section))
- _headerCells[section] = Controller.Model.GetHeaderCell((int)section);
+ _headerCells[section] = View.Model.GetHeaderCell((int)section);
var result = _headerCells[section];
@@ -50,7 +48,7 @@ namespace Xamarin.Forms.Platform.iOS
public override UIView GetViewForHeader(UITableView tableView, nint section)
{
if (!_headerCells.ContainsKey((int)section))
- _headerCells[section] = Controller.Model.GetHeaderCell((int)section);
+ _headerCells[section] = View.Model.GetHeaderCell((int)section);
var result = _headerCells[section];
@@ -71,35 +69,35 @@ namespace Xamarin.Forms.Platform.iOS
if (indexPath == null)
return;
- Controller.Model.RowLongPressed(indexPath.Section, indexPath.Row);
+ View.Model.RowLongPressed(indexPath.Section, indexPath.Row);
}
public override nint NumberOfSections(UITableView tableView)
{
BindGestures(tableView);
- return Controller.Model.GetSectionCount();
+ return View.Model.GetSectionCount();
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
- Controller.Model.RowSelected(indexPath.Section, indexPath.Row);
+ View.Model.RowSelected(indexPath.Section, indexPath.Row);
if (AutomaticallyDeselect)
tableView.DeselectRow(indexPath, true);
}
public override nint RowsInSection(UITableView tableview, nint section)
{
- return Controller.Model.GetRowCount((int)section);
+ return View.Model.GetRowCount((int)section);
}
public override string[] SectionIndexTitles(UITableView tableView)
{
- return Controller.Model.GetSectionIndexTitles();
+ return View.Model.GetSectionIndexTitles();
}
public override string TitleForHeader(UITableView tableView, nint section)
{
- return Controller.Model.GetSectionTitle((int)section);
+ return View.Model.GetSectionTitle((int)section);
}
void BindGestures(UITableView tableview)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
index fd03d46..6456c16 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
@@ -55,13 +55,11 @@ namespace Xamarin.Forms.Platform.iOS
VisualElementTracker _tracker;
- IPageController PageController => Element as IPageController;
- IElementController ElementController => Element as IElementController;
+ Page PageController => Element as Page;
+ Element ElementController => Element as Element;
protected MasterDetailPage MasterDetailPage => _masterDetailPage ?? (_masterDetailPage = (MasterDetailPage)Element);
- IMasterDetailPageController MasterDetailPageController => MasterDetailPage as IMasterDetailPageController;
-
UIBarButtonItem PresentButton
{
get { return _innerDelegate == null ? null : _innerDelegate.PresentButton; }
@@ -187,10 +185,10 @@ namespace Xamarin.Forms.Platform.iOS
var masterBounds = _masterController.View.Frame;
if (!masterBounds.IsEmpty)
- MasterDetailPageController.MasterBounds = new Rectangle(0, 0, masterBounds.Width, masterBounds.Height);
+ MasterDetailPage.MasterBounds = new Rectangle(0, 0, masterBounds.Width, masterBounds.Height);
if (!detailsBounds.IsEmpty)
- MasterDetailPageController.DetailBounds = new Rectangle(0, 0, detailsBounds.Width, detailsBounds.Height);
+ MasterDetailPage.DetailBounds = new Rectangle(0, 0, detailsBounds.Width, detailsBounds.Height);
}
public override void ViewDidLoad()
@@ -220,14 +218,14 @@ namespace Xamarin.Forms.Platform.iOS
{
// On IOS8 the MasterViewController ViewAppear/Disappear weren't being called correctly after rotation
// We now close the Master by using the new SplitView API, basicly we set it to hidden and right back to the Normal/AutomaticMode
- if (!MasterDetailPageController.ShouldShowSplitMode && _masterVisible)
+ if (!MasterDetailPage.ShouldShowSplitMode && _masterVisible)
{
- MasterDetailPageController.CanChangeIsPresented = true;
+ MasterDetailPage.CanChangeIsPresented = true;
PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden;
PreferredDisplayMode = UISplitViewControllerDisplayMode.Automatic;
}
- MasterDetailPageController.UpdateMasterBehavior();
+ MasterDetailPage.UpdateMasterBehavior();
MessagingCenter.Send<IVisualElementRenderer>(this, NavigationRenderer.UpdateToolbarButtons);
base.WillRotate(toInterfaceOrientation, duration);
}
@@ -281,24 +279,24 @@ namespace Xamarin.Forms.Platform.iOS
if (e.PropertyName == "Master" || e.PropertyName == "Detail")
UpdateControllers();
- else if (e.PropertyName == MasterDetailPage.IsPresentedProperty.PropertyName)
+ else if (e.PropertyName == Xamarin.Forms.MasterDetailPage.IsPresentedProperty.PropertyName)
ToggleMaster();
- else if (e.PropertyName == MasterDetailPage.IsGestureEnabledProperty.PropertyName)
- PresentsWithGesture = MasterDetailPage.IsGestureEnabled;
+ else if (e.PropertyName == Xamarin.Forms.MasterDetailPage.IsGestureEnabledProperty.PropertyName)
+ base.PresentsWithGesture = this.MasterDetailPage.IsGestureEnabled;
MessagingCenter.Send<IVisualElementRenderer>(this, NavigationRenderer.UpdateToolbarButtons);
}
void MasterControllerWillAppear(object sender, EventArgs e)
{
_masterVisible = true;
- if (MasterDetailPageController.CanChangeIsPresented)
+ if (MasterDetailPage.CanChangeIsPresented)
ElementController.SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, true);
}
void MasterControllerWillDisappear(object sender, EventArgs e)
{
_masterVisible = false;
- if (MasterDetailPageController.CanChangeIsPresented)
+ if (MasterDetailPage.CanChangeIsPresented)
ElementController.SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, false);
}
@@ -309,7 +307,7 @@ namespace Xamarin.Forms.Platform.iOS
void ToggleMaster()
{
- if (_masterVisible == MasterDetailPage.IsPresented || MasterDetailPageController.ShouldShowSplitMode)
+ if (_masterVisible == MasterDetailPage.IsPresented || MasterDetailPage.ShouldShowSplitMode)
return;
PerformButtonSelector();
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
index c54c0c9..5093c77 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
@@ -20,7 +20,7 @@ namespace Xamarin.Forms.Platform.iOS
{
}
- IWebViewController ElementController => Element as IWebViewController;
+ WebView WebView => Element as WebView;
public VisualElement Element { get; private set; }
@@ -36,9 +36,9 @@ namespace Xamarin.Forms.Platform.iOS
var oldElement = Element;
Element = element;
Element.PropertyChanged += HandlePropertyChanged;
- ElementController.EvalRequested += OnEvalRequested;
- ElementController.GoBackRequested += OnGoBackRequested;
- ElementController.GoForwardRequested += OnGoForwardRequested;
+ WebView.EvalRequested += OnEvalRequested;
+ WebView.GoBackRequested += OnGoBackRequested;
+ WebView.GoForwardRequested += OnGoForwardRequested;
Delegate = new CustomWebViewDelegate(this);
BackgroundColor = UIColor.Clear;
@@ -98,9 +98,9 @@ namespace Xamarin.Forms.Platform.iOS
StopLoading();
Element.PropertyChanged -= HandlePropertyChanged;
- ElementController.EvalRequested -= OnEvalRequested;
- ElementController.GoBackRequested -= OnGoBackRequested;
- ElementController.GoForwardRequested -= OnGoForwardRequested;
+ WebView.EvalRequested -= OnEvalRequested;
+ WebView.GoBackRequested -= OnGoBackRequested;
+ WebView.GoForwardRequested -= OnGoForwardRequested;
_tracker?.Dispose();
_packager?.Dispose();
@@ -162,8 +162,8 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateCanGoBackForward()
{
- ElementController.CanGoBack = CanGoBack;
- ElementController.CanGoForward = CanGoForward;
+ ((IWebViewController)WebView).CanGoBack = CanGoBack;
+ ((IWebViewController)WebView).CanGoForward = CanGoForward;
}
class CustomWebViewDelegate : UIWebViewDelegate
@@ -178,8 +178,6 @@ namespace Xamarin.Forms.Platform.iOS
_renderer = renderer;
}
- IWebViewController WebViewController => WebView;
-
WebView WebView
{
get { return (WebView)_renderer.Element; }
@@ -188,7 +186,7 @@ namespace Xamarin.Forms.Platform.iOS
public override void LoadFailed(UIWebView webView, NSError error)
{
var url = GetCurrentUrl();
- WebViewController.SendNavigated(new WebNavigatedEventArgs(_lastEvent, new UrlWebViewSource { Url = url }, url, WebNavigationResult.Failure));
+ WebView.SendNavigated(new WebNavigatedEventArgs(_lastEvent, new UrlWebViewSource { Url = url }, url, WebNavigationResult.Failure));
_renderer.UpdateCanGoBackForward();
}
@@ -200,11 +198,11 @@ namespace Xamarin.Forms.Platform.iOS
_renderer._ignoreSourceChanges = true;
var url = GetCurrentUrl();
- ((IElementController)WebView).SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = url });
+ WebView.SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = url });
_renderer._ignoreSourceChanges = false;
var args = new WebNavigatedEventArgs(_lastEvent, WebView.Source, url, WebNavigationResult.Success);
- WebViewController.SendNavigated(args);
+ WebView.SendNavigated(args);
_renderer.UpdateCanGoBackForward();
}
@@ -242,7 +240,7 @@ namespace Xamarin.Forms.Platform.iOS
var lastUrl = request.Url.ToString();
var args = new WebNavigatingEventArgs(navEvent, new UrlWebViewSource { Url = lastUrl }, lastUrl);
- WebViewController.SendNavigating(args);
+ WebView.SendNavigating(args);
_renderer.UpdateCanGoBackForward();
return !args.Cancel;
}