diff options
author | Rui Marinho <me@ruimarinho.net> | 2016-06-17 17:29:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 17:29:43 +0100 |
commit | dae4dfa94c71246bfc597d23449a6ba43e5255ff (patch) | |
tree | c6b7a06f930c8bf21a412b748f226ad844895362 /Xamarin.Forms.Platform.iOS/Cells | |
parent | 925fc0aa588a060eb23fa16c1d225dd030012c23 (diff) | |
download | xamarin-forms-dae4dfa94c71246bfc597d23449a6ba43e5255ff.tar.gz xamarin-forms-dae4dfa94c71246bfc597d23449a6ba43e5255ff.tar.bz2 xamarin-forms-dae4dfa94c71246bfc597d23449a6ba43e5255ff.zip |
Fix 39802 (#217)
* [iOS] When using ContextActionsCell make sure we don't show the ContentCell separator
* [Android] Don't write separator view if not needed
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Cells')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs | 3 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs index f1a53917..4d9918fa 100644 --- a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs +++ b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs @@ -89,6 +89,9 @@ namespace Xamarin.Forms.Platform.iOS if (contextCell != null) { contextCell.Update(tableView, cell, nativeCell); + var viewTableCell = contextCell.ContentCell as ViewCellRenderer.ViewTableCell; + if (viewTableCell != null) + viewTableCell.SupressSeparator = true; nativeCell = contextCell; } diff --git a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs index f1cb2fb6..4f8a43e8 100644 --- a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs @@ -86,11 +86,19 @@ namespace Xamarin.Forms.Platform.iOS get { return ViewCell; } } + internal bool SupressSeparator { get; set; } + public override void LayoutSubviews() { //This sets the content views frame. base.LayoutSubviews(); + if (SupressSeparator) + { + var oldFrame = Frame; + ContentView.Bounds = Frame = new RectangleF(oldFrame.Location, new SizeF(oldFrame.Width, oldFrame.Height + 0.5f)); + } + var contentFrame = ContentView.Frame; var view = ViewCell.View; @@ -114,8 +122,9 @@ namespace Xamarin.Forms.Platform.iOS var height = size.Height > 0 ? size.Height : double.PositiveInfinity; var result = renderer.Element.Measure(width, height); - // make sure to add in the separator - return new SizeF(size.Width, (float)result.Request.Height + 1f / UIScreen.MainScreen.Scale); + // make sure to add in the separator if needed + var finalheight = ((float)result.Request.Height + (SupressSeparator ? 0f : 1f)) / UIScreen.MainScreen.Scale; + return new SizeF(size.Width, finalheight); } protected override void Dispose(bool disposing) |