diff options
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs | 6 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs | 31 |
2 files changed, 31 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs index abd8f24f..e77778ce 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs @@ -44,5 +44,11 @@ namespace Xamarin.Forms.Platform.iOS else Control.StopAnimating(); } + + internal void PreserveState() + { + if (Control != null && !Control.IsAnimating && Element != null && Element.IsRunning) + Control.StartAnimating(); + } } }
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs index 99a10666..8581e26e 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs @@ -780,12 +780,13 @@ namespace Xamarin.Forms.Platform.iOS public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { - UITableViewCell nativeCell = null; + Cell cell; + UITableViewCell nativeCell; var cachingStrategy = Controller.CachingStrategy; if (cachingStrategy == ListViewCachingStrategy.RetainElement) { - var cell = GetCellForPath(indexPath); + cell = GetCellForPath(indexPath); nativeCell = CellTableViewCell.GetNativeCell(tableView, cell); } else if (cachingStrategy == ListViewCachingStrategy.RecycleElement) @@ -794,13 +795,13 @@ namespace Xamarin.Forms.Platform.iOS nativeCell = tableView.DequeueReusableCell(ContextActionsCell.Key + id); if (nativeCell == null) { - var cell = GetCellForPath(indexPath); + cell = GetCellForPath(indexPath); nativeCell = CellTableViewCell.GetNativeCell(tableView, cell, true, id.ToString()); } else { var templatedList = TemplatedItemsView.TemplatedItems.GetGroup(indexPath.Section); - var cell = (Cell)((INativeElementView)nativeCell).Element; + cell = (Cell)((INativeElementView)nativeCell).Element; ICellController controller = cell; controller.SendDisappearing(); templatedList.UpdateContent(cell, indexPath.Row); @@ -813,10 +814,10 @@ namespace Xamarin.Forms.Platform.iOS var bgColor = tableView.IndexPathForSelectedRow != null && tableView.IndexPathForSelectedRow.Equals(indexPath) ? UIColor.Clear : DefaultBackgroundColor; SetCellBackgroundColor(nativeCell, bgColor); - + PreserveActivityIndicatorState(cell); return nativeCell; } - + public override nfloat GetHeightForHeader(UITableView tableView, nint section) { if (List.IsGroupingEnabled) @@ -1079,6 +1080,24 @@ namespace Xamarin.Forms.Platform.iOS base.Dispose(disposing); } + + void PreserveActivityIndicatorState(Element element) + { + if (element == null) + return; + + var activityIndicator = element as ActivityIndicator; + if (activityIndicator != null) + { + var renderer = Platform.GetRenderer(activityIndicator) as ActivityIndicatorRenderer; + renderer?.PreserveState(); + } + else + { + foreach (Element childElement in (element as IElementController).LogicalChildren) + PreserveActivityIndicatorState(childElement); + } + } } } |