Xamarin iOS navigation bar image

Viewed 1587

Hi im trying to include a logo into the navigation bar on my iOS app. The logo has a size of 160x40 and im not using a custom navigation bar.

What I found was solutions to include like a small 40x40 button at the right side, but is there a way to include a larger item on the right side?

1 Answers

You can add a UIImageView to the UINavigationBar

var navBar = NavigationController.NavigationBar;
var imageView = new UIImageView(UIImage.FromBundle("sushiLogo.png"));
imageView.Frame = new CGRect((navBar.Bounds.Width / 5) * 3, 0, imageView.Image.CGImage.Width, navBar.Bounds.Height);
navBar.AddSubview(imageView);

enter image description here

Note: Remember to keep a reference to it and adjust its Frame upon device rotation.

Related