diff options
author | Jimmy Garrido <jimmygarrido@outlook.com> | 2016-11-16 00:21:55 -0800 |
---|---|---|
committer | Stephane Delcroix <stephane@delcroix.org> | 2016-11-16 09:21:55 +0100 |
commit | 46104e9ce186bb06567755f979414e0cbc426db6 (patch) | |
tree | 8e029151b04c9ca9427a328c13bcd3c91f61cf83 | |
parent | ffab780c2acd9ef49268d731e14b11b5fdbc3293 (diff) | |
download | xamarin-forms-46104e9ce186bb06567755f979414e0cbc426db6.tar.gz xamarin-forms-46104e9ce186bb06567755f979414e0cbc426db6.tar.bz2 xamarin-forms-46104e9ce186bb06567755f979414e0cbc426db6.zip |
[iOS] Fix AccessoryView covered by section index list (#493)
* [iOS] Fix AccessoryView below section index list
* Add UITest
4 files changed, 83 insertions, 5 deletions
diff --git a/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs index 6b2ab38f..87ede16f 100644 --- a/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs +++ b/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs @@ -18,6 +18,7 @@ using RectangleF = CoreGraphics.CGRect; [assembly: ExportRenderer(typeof(CustomMapView), typeof(CustomIOSMapRenderer))] [assembly: ExportRenderer(typeof(TabbedPage), typeof(TabbedPageWithCustomBarColorRenderer))] [assembly: ExportRenderer(typeof(Bugzilla43161.AccessoryViewCell), typeof(AccessoryViewCellRenderer))] +[assembly: ExportRenderer(typeof(Bugzilla36802.AccessoryViewCell), typeof(AccessoryViewCellRenderer))] namespace Xamarin.Forms.ControlGallery.iOS { public class CustomIOSMapRenderer : ViewRenderer<CustomMapView, MKMapView> diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36802.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36802.cs new file mode 100644 index 00000000..59a64752 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36802.cs @@ -0,0 +1,79 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; +using System.Linq; +using System.Collections.ObjectModel; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls +{ + + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 36802, "[iOS] AccessoryView Partially Hidden When Using RecycleElement and GroupShortName", PlatformAffected.iOS)] + public class Bugzilla36802 : TestContentPage + { + const string Instructions = "On iOS, all the list items below should have an AccessoryView visible. If any are not visible or are covered by the section index list then this test has failed."; + ObservableCollection<GroupedItem> grouped { get; set; } + ListView lstView; + + public class AccessoryViewCell : ViewCell + { + public AccessoryViewCell() + { + var label = new Label(); + label.SetBinding(Label.TextProperty, "."); + View = label; + } + } + + public class GroupedItem : ObservableCollection<string> + { + public string LongName { get; set; } + public string ShortName { get; set; } + } + + protected override void Init() + { + var label = new Label { Text = Instructions }; + grouped = new ObservableCollection<GroupedItem>(); + lstView = new ListView(ListViewCachingStrategy.RecycleElement) { + IsGroupingEnabled = true, + ItemTemplate = new DataTemplate(typeof(AccessoryViewCell)), + ItemsSource = grouped, + GroupDisplayBinding = new Binding("LongName"), + GroupShortNameBinding = new Binding("ShortName") + }; + + var grp1 = new GroupedItem() { LongName = "Group 1", ShortName = "1" }; + var grp2 = new GroupedItem() { LongName = "Group 2", ShortName = "2" }; + + for (int i = 1; i < 4; i++) + { + grp1.Add($"Item #{i}"); + grp2.Add($"Item #{i}"); + } + + grouped.Add(grp1); + grouped.Add(grp2); + + Content = new StackLayout + { + Children = { + label, + lstView + } + }; + } + +#if (UITEST && __IOS__) + [Test] + public void Bugzilla36802Test() + { + RunningApp.Screenshot("AccessoryView partially hidden test"); + } +#endif + } +} diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index dc1e6040..d887d5c3 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -457,6 +457,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla41029.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla39908.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla39489.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla36802.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml"> diff --git a/Xamarin.Forms.Platform.iOS/ContextActionCell.cs b/Xamarin.Forms.Platform.iOS/ContextActionCell.cs index 74f354c5..39e0a359 100644 --- a/Xamarin.Forms.Platform.iOS/ContextActionCell.cs +++ b/Xamarin.Forms.Platform.iOS/ContextActionCell.cs @@ -87,14 +87,11 @@ namespace Xamarin.Forms.Platform.iOS { base.LayoutSubviews(); - if (_scroller == null || (_scroller != null && _scroller.Frame == Bounds)) + if (_scroller == null || (_scroller != null && _scroller.Frame.Width == ContentView.Bounds.Width)) return; Update(_tableView, _cell, ContentCell); - _scroller.Frame = Bounds; - ContentCell.Frame = Bounds; - if (ContentCell is ViewCellRenderer.ViewTableCell && ContentCell.Subviews.Length > 0 && Math.Abs(ContentCell.Subviews[0].Frame.Height - Bounds.Height) > 1) { // Something goes weird inside iOS where LayoutSubviews wont get called when updating the bounds if the user @@ -130,7 +127,7 @@ namespace Xamarin.Forms.Platform.iOS } var height = Frame.Height; - var width = tableView.Frame.Width; + var width = ContentView.Frame.Width; nativeCell.Frame = new RectangleF(0, 0, width, height); nativeCell.SetNeedsLayout(); |