Hello Gyus!!!!
I am using the custom renderer found here in the forum.
The problem is that the first time you open the screen above the buttons are rendered correctly, but go to another tab the toolbar buttons back to her home state.
<TabbedPage.ToolbarItems>
</TabbedPage.ToolbarItems>
<br />
[assembly: ExportRenderer(typeof(ContentPage), typeof(ContentPageRenderer))]<br />
namespace Pdv.Presentation.Mobile.iOS.Renderers<br />
{</p>
<p>public class ContentPageRenderer : PageRenderer<br />
{<br />
public override void ViewWillAppear(bool animated)<br />
{<br />
base.ViewWillAppear(animated);</p>
<pre><code> var contentPage = this.Element as ContentPage;
if (contentPage == null || NavigationController == null)
return;
var itemsInfo = contentPage.ToolbarItems;
var navigationItem = this.NavigationController.TopViewController.NavigationItem;
var leftNativeButtons = (navigationItem.LeftBarButtonItems ?? new UIBarButtonItem[] { }).ToList();
var rightNativeButtons = (navigationItem.RightBarButtonItems ?? new UIBarButtonItem[] { }).ToList();
var newLeftButtons = new UIBarButtonItem[] { }.ToList();
var newRightButtons = new UIBarButtonItem[] { }.ToList();
rightNativeButtons.ForEach(nativeItem =>
{
// [Hack] Get Xamarin private field "item"
var field = nativeItem.GetType().GetField("_item", BindingFlags.NonPublic | BindingFlags.Instance);
if (field == null)
return;
var info = field.GetValue(nativeItem) as ToolbarItem;
if (info == null)
return;
if (info.Priority == 0)
{
if (!leftNativeButtons.Any())
newLeftButtons.Add(nativeItem);
}
else
newRightButtons.Add(nativeItem);
});
leftNativeButtons.ForEach(nativeItem =>
{
newLeftButtons.Add(nativeItem);
});
navigationItem.RightBarButtonItems = newRightButtons.ToArray();
navigationItem.LeftBarButtonItems = newLeftButtons.ToArray();
}
}
}
I need the renderer control maintains its state set up this custom.