Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Navigation Back Button Image not working with Custom Renderer

$
0
0

I have taken my working Navigation Renderer and added setting the Back Button to an image and it is not working. I am getting the word Back instead of the desired image. Here's my code:

using System;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using myapp.iOS;

[assembly:ExportRenderer (typeof(NavigationPage), typeof(CustomNavigationRenderer))]

namespace myapp.iOS
{
    public class CustomNavigationRenderer : NavigationRenderer
    {

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            NavigationBar.SetBackgroundImage (UIImage.FromBundle ("header"), UIBarMetrics.Default);
            UIBarButtonItem but = new UIBarButtonItem (UIImage.FromBundle ("icon-back"), 
                                      UIBarButtonItemStyle.Plain, 
                                      (sender, args) => {
                    NavigationController.PopViewController (true);
                });
            NavigationItem.SetLeftBarButtonItem(but, true);
        }
    }
}

I trap the code at the last line and see that the button has been created. However, the image does not appear.

Suggestions???

PS: NavigationItem.LeftBarButtonItem = but;did not work either.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>