Search code examples
iphonexamarin.iosuinavigationitem

Customize the Navigation Bar with MonoTouch by adding an image


Is there a way to customize the navigation bar with monoTouch? I am trying to add an imageView to it but unfortunately it doesn't work. Here is my code:

imageView = new UIImageView();
var image = UIImage.FromFile("image.png");
var small = image.Scale (new SizeF (35f, 35f));
imageView.Image = small;
NavigationItem.TitleView = imageView;

Solution

  • I did it. I messed up with passing the image to the view. This is how it works.

    var image = UIImage.FromFile("image.png");
    var small = image.Scale (new SizeF (35f, 35f));
    UIImageView imageView = new UIImageView(small)
    NavigationItem.TitleView = imageView;